System environment variables %user%

Here you are welcome to post Push2Run feature requests
Post Reply
getgonged
Posts: 10
Joined: Fri May 01, 2020 11:14 am

System environment variables %user%

Post by getgonged »

Hi

I noticed the export function for Push2Run was added, and it looks to be super useful. However, I have one request.

I'm using two computers for push2run.
One I use the C:\ drive, the other I use D:\. Also, I have different user names on each one.

When I export and I want to access My Documents or some other user folder this poses a problem between both devices.

C:\Users\User Name\
D:\Users\User Name2\

Is it possible to add recognition of windows system environments like %USERPROFILE% before a path.

This command works in DOS for example if you type CD %USERPROFILE% to demonstrate.

This would give a very high compatibility between computers as it would automatically resolve the drive and path to the users folder.

Thanks so much!
RobLatour
Site Admin
Posts: 1003
Joined: Mon Feb 19, 2018 11:43 am

Re: System environment variables %user%

Post by RobLatour »

Not exactly sure what you are after, do you want to always save the export file in the same place on each pc?

If yes, Push2Run will remember the last folder you exported your cards to and will use that as the starting folder for the next time you do an export. So if you don't change it again, it should always just export to the same place.
getgonged
Posts: 10
Joined: Fri May 01, 2020 11:14 am

Re: System environment variables %user%

Post by getgonged »

Oh sorry, I miscommunicated this request. What I meant is for inside each P2R card, where there is the Open and Start Directory textboxes. If these would allow relative directory paths.

So if I am on computer 1, and my commands are all saved with file paths to D:\ drive. When I export, all of these commands store the D:\ path. However, when I then import these on to computer 2. Computer 2 has C:\ as the main hard drive path. The commands will then be broken and no longer work on computer 2.

My username and thus user folders might be different between the computers 1 and 2 as well.

Here is an example of how a relative link to user profile's directory works on windows:
https://www.computerhope.com/issues/ch000109.htm

This is a larger list of environment variables Microsoft supports: https://pureinfotech.com/list-environme ... indows-10/

User folder uses:
%userprofile% which resolves to the user's profile folder


Downloads Folder:
%userprofile%/Downloads
This auto resolves to:
C:\Users\jeffuser\Downloads\

or %programfiles% automatically resolves to program files folder on whichever windows computer I am on.


I think the only ones that are really important would be the user profile, and the programs file variables.

I'm not sure what programming language is used for this program but this might be an example:
https://stackoverflow.com/questions/999 ... serprofile
RobLatour
Site Admin
Posts: 1003
Joined: Mon Feb 19, 2018 11:43 am

Re: System environment variables %user%

Post by RobLatour »

Thanks - I understand now.

Yes, I believe that would be quite doable - in fact, I just programmed it in and tested it over the last hour or so.

The change would allow environmental variables ( list here ) to be used in the open, start directory, and parameter fields of a Push2Run card.

If you would like to test with a beta copy, please e-mail me at info@push2run.com

(moved this post from the general category to the feature request category)
RobLatour
Site Admin
Posts: 1003
Joined: Mon Feb 19, 2018 11:43 am

Re: System environment variables %user%

Post by RobLatour »

Support for system environment variables are now available in version 3.4.2 of Push2Run which was released today.

These may be used in the Open, Start Directory, and Parameters fields; for more information please see https://push2run.com/help_v3.4.2.0.html
under where it says 'Notes'.
getgonged
Posts: 10
Joined: Fri May 01, 2020 11:14 am

Re: System environment variables %user%

Post by getgonged »

Wow, This is awesome! Thanks so much for implementing this feature. I can now seamlessly use push2run between my computers. I always wanted a program like this, it has made my work life so much easier. I'm using the %onedrive% environment variable even, so cool! Thanks for this update :)
RobLatour
Site Admin
Posts: 1003
Joined: Mon Feb 19, 2018 11:43 am

Re: System environment variables %user%

Post by RobLatour »

You're very welcome!
Post Reply