AutoRun LWMenu

If you are currently developing portable freeware or planning to do so, use this forum to discuss technical implementation, seek out like-minded developers for partnership, or solicit interested users for beta testing.
Message
Author
lwc
Posts: 319
Joined: Tue Jun 26, 2012 10:40 pm
Contact:

Re: AutoRun LWMenu

#376 Post by lwc »

-ElCoyot- wrote: Fri Nov 29, 2024 7:09 am I'm completely confused with "setenv=". You can use an example of the autorun.inf file of the program, where APPDATA is used and it is registered in setenv=
Preferably a ready-made program with a config.
The default %APPDATA% is C:\Users\%USERNAME%\AppData\Roaming
If your launched program saves files in %APPDATA%, then if you use setenv=APPDATA|c:\something it will trick the launched program to save its data in c:\something instead.
It will thus practically turn the launched program into a portable one.

Usually it's that simple. But for %APPDATA% and %USERPROFILE% specifically it's more complex because:
  1. While it might seem the launched program uses %APPDATA%, some programs actually use %USERPROFILE%\AppData\Roaming, i.e. they are hardcoded to use AppData\Roaming even if %APPDATA% points somewhere else.
  2. Some programs that use %USERPROFILE% expect it to be an absolute folder. In those cases you can use setenv=USERPROFILE|..\Something whereas the ..\ part tricks the launched program to think it's an absolute path.
    For example, if your desired folder is c:\parent\child then you could write ..\child.

-ElCoyot-
Posts: 144
Joined: Thu Sep 02, 2021 4:42 am

Re: AutoRun LWMenu

#377 Post by -ElCoyot- »

Can you upload an example of a ready-made program to some kind of exchanger? Have you tested this feature in any program?

lwc
Posts: 319
Joined: Tue Jun 26, 2012 10:40 pm
Contact:

Re: AutoRun LWMenu

#378 Post by lwc »

-ElCoyot- wrote: Tue Dec 03, 2024 10:35 pm Can you upload an example of a ready-made program to some kind of exchanger? Have you tested this feature in any program?
I use setenv perfectly in general.
If you mean %USERPROFILE% specifically, sl23 gave a working example of it with StemRoller.

-ElCoyot-
Posts: 144
Joined: Thu Sep 02, 2021 4:42 am

Re: AutoRun LWMenu

#379 Post by -ElCoyot- »

I use setenv perfectly in general.
Therefore, I would like to see a ready-made assembled program.

User avatar
sl23
Posts: 113
Joined: Fri Jan 02, 2015 6:25 am

Re: AutoRun LWMenu

#380 Post by sl23 »

setenv= is an environment variable.
For my use, I used it as the command line arguments for a shortcut.

So here, for example, this emulator needs the path set as:
  • "X:\path-to-app\pcsx2-qt.exe" "X:\path-to-game\Broken Sword 3- The Sleeping Dragon.iso"

Code: Select all

[CUSTOM MENU]
closemenuonclick=1
singlerun=1
titletext=Bizhawk
buttonwidth=300
buttonheight=30
setenv=Path1|pcsx2-qt.exe
setenv=Path2|..\..\..\..\Documents\Games\Playstation

[BUTTON1]
buttontext=Broken Sword 3- The Sleeping Dragon
relativepathandfilename=%Path1%
optionalcommandlineparams="%Path2%\Broken Sword 3- The Sleeping Dragon.iso"
But I used two separate setenv, one for each, that way, creating many entries doesn't mean repeating the first path. I can just do this:

Code: Select all

[BUTTON1]
buttontext=Broken Sword 3 - The Sleeping Dragon
relativepathandfilename=%Path1%
optionalcommandlineparams="%Path2%\Broken Sword 3 - The Sleeping Dragon.iso"

[BUTTON2]
buttontext=Fahrenheit
relativepathandfilename=%Path1%
optionalcommandlineparams="%Path2%\Fahrenheit.iso"
Then adjusting Path1 means I can just change the single setenv instead of every button entry.

That's just how I use it though.

I didn't keep my previous attempts at portablising other apps as I found it easier to do so with X-Launcher. Especially after the issues with StemRoller. Unfortunate really, as I would like to use AutoRunMenu tbh.
Latest X-Launcher_x64 update - Compiled with Aut2exe_x64.exe v3.3.16.1
Latest X-Launcher_x64 v1.5.4 update - Compiled with Aut2exe_x64.exe v3.2.12.1

User avatar
sl23
Posts: 113
Joined: Fri Jan 02, 2015 6:25 am

Re: AutoRun LWMenu

#381 Post by sl23 »

lwc wrote: Wed Dec 04, 2024 3:32 am
-ElCoyot- wrote: Tue Dec 03, 2024 10:35 pm Can you upload an example of a ready-made program to some kind of exchanger? Have you tested this feature in any program?
I use setenv perfectly in general.
If you mean %USERPROFILE% specifically, sl23 gave a working example of it with StemRoller.
Actually, it wasn't working with StemRoller. You said it may be due to the app, but I don't know. All I know is that X-Launcher worked without a hitch in this instance. Is it worth you looking at X-Launcher code to see why this is? May help.
Latest X-Launcher_x64 update - Compiled with Aut2exe_x64.exe v3.3.16.1
Latest X-Launcher_x64 v1.5.4 update - Compiled with Aut2exe_x64.exe v3.2.12.1

lwc
Posts: 319
Joined: Tue Jun 26, 2012 10:40 pm
Contact:

Re: AutoRun LWMenu

#382 Post by lwc »

In that link you stated it does work in StemRoller, as long as you use setenv=%USERPROFILE%|..\something
Do you want me to add a feature to always convert the X in setenv=%USERPROFILE%|X to an absolute folder, thus sparing you the 2 dots? Or maybe add this feature to every attempt to overwrite built-in environmental variables which resembles paths?

Or did you mean %APPDATA%? If so, is there a chance X-Launcher modifies %APPDATA% not just for the launched program but for the entire system (until the launched program gets closed)? You can easily test it using X-Launcher to modify %APPDATA% for a program that uses it, but before closing that program run another program that writes into %APPDATA% and see if it still writes there.

-ElCoyot-
Posts: 144
Joined: Thu Sep 02, 2021 4:42 am

Re: AutoRun LWMenu

#383 Post by -ElCoyot- »

Try this program. The program writes data to APPDATA. Can you apply setenv= to write to the program folder?
https://www.airexplorer.net/en/download/

User avatar
sl23
Posts: 113
Joined: Fri Jan 02, 2015 6:25 am

Re: AutoRun LWMenu

#384 Post by sl23 »

Ah ok, it was a while ago and last I recall is that it didn't and you asked me to check with the dev about how he handles AppData or something like that. So I posted on his Github page about it. But I'll take your word for it! :D

Tbh, I don't know the implications of adding it by default. Are there any situations where you might not want that? If not, then it seems to me to be better to have it set by default. Whatever you think is best.
Latest X-Launcher_x64 update - Compiled with Aut2exe_x64.exe v3.3.16.1
Latest X-Launcher_x64 v1.5.4 update - Compiled with Aut2exe_x64.exe v3.2.12.1

lwc
Posts: 319
Joined: Tue Jun 26, 2012 10:40 pm
Contact:

Re: AutoRun LWMenu

#385 Post by lwc »

sl23 wrote: Fri Dec 06, 2024 2:21 am Tbh, I don't know the implications of adding it by default. Are there any situations where you might not want that? If not, then it seems to me to be better to have it set by default. Whatever you think is best.
There's literally zero documentation about it. But I guess with portability being a niche, it makes sense Microsoft (the king of non portability, see Registry) never anticipated people to use relative paths in the built-in environmental variables.

But before I do it, can you do the aforementioned test in X-Launcher? Launch a program in which you modify %APPDATA% (like StemRoller) and while that program runs, launch outside of X-Launcher another program that writes to %APPDATA% (like the program ElCoyot mentioned). See if the second program manages to write to the original %APPDATA%.

Actually, if you want to keep it simple, save the following as appdata-writer.bat and this will be your second program (to run without X-Launcher):

Code: Select all

@echo Just testing, delete testing.txt afterwards>%APPDATA%\testing.txt
All it does is create %APPDATA%\testing.txt

-ElCoyot-
Posts: 144
Joined: Thu Sep 02, 2021 4:42 am

Re: AutoRun LWMenu

#386 Post by -ElCoyot- »

I wanted to ask you something else. Will the ALLUSERSPROFILE variable be intercepted when using setenv= ?

lwc
Posts: 319
Joined: Tue Jun 26, 2012 10:40 pm
Contact:

Re: AutoRun LWMenu

#387 Post by lwc »

-ElCoyot- wrote: Fri Dec 06, 2024 8:02 am I wanted to ask you something else. Will the ALLUSERSPROFILE variable be intercepted when using setenv= ?
Sure, you can intercept whatever variable you like. But as mentioned it might have to be an absolute folder.

-ElCoyot-
Posts: 144
Joined: Thu Sep 02, 2021 4:42 am

Re: AutoRun LWMenu

#388 Post by -ElCoyot- »

Nothing is intercepted
https://fastkeysautomation.com/

Post Reply