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
User avatar
sl23
Posts: 84
Joined: Fri Jan 02, 2015 6:25 am

Re: AutoRun LWMenu

#226 Post by sl23 »

Ok I'm giving this a go now.
Just a few questions, I am no programmer, but have worked with Rainmeter code for years and some other little bits here and there, so feel confident on getting this working once I know what does what.

The section titled [CUSTOM CD MENU] I assume is for the menu, ie parameters for how it is shown and how it works?

Primarily, I am interested in solving file and folder remains left on C: after running apps. I'm not confident messing with the registry. Also, to launch programs standalone like X-Launcher, ie, without showing the Menu.

Are there any example INF's I could use as a template? I Have looked through the one supplied with the EXE but am not really understanding exactly everything I need.

Once setup, do I click the AutoRun.exe in order to run the app? So, again, this will work as X-Launcher?

Sorry for the repetition, just trying to be clear what I'm trying to achieve. :)
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: 84
Joined: Fri Jan 02, 2015 6:25 am

Re: AutoRun LWMenu

#227 Post by sl23 »

After an hour or so, I've come up with this for StemRoller:
Spoiler!   

Code: Select all

[AutoRun]
open=AutoRun.exe
icon=AutoRun.exe, 0

[CUSTOM CD MENU]
hidetrayicon=1 ;uncomment to hide
skiptobutton=1
singlerun=1

[BUTTON1]
buttontext=Stem Roller
relativepathandfilename=App\StemRoller\StemRoller.exe
registry=
backuppath=App
closemenuonclick=1
setenv=
But I am not sure how to resolve the AppData folder. With X-Launcher, you can specify "FixAppData=true" and all AppData folders relating to StemRoller will be stored in X-Launcher's "Lib" folder and used from that location. Does AutoRun work the same way? If so how do I specify the directory to store these files? I don't want to keep moving them back and forward from the App's directory and into AppData then back. I would like to store them in the App directory and use them from there, as X-Launcher does. Can that be done?

I understand how the icon works for the Menu itself, but can we add an icon to the AutoRun.exe so it appears in Start Menu with an icon?

Thanks for your 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: 284
Joined: Tue Jun 26, 2012 10:40 pm
Contact:

Re: AutoRun LWMenu

#228 Post by lwc »

  1. [CUSTOM CD MENU] is a place for general settings. It's called Menu for the same reason it's called CD - backward compatibility to when it used to be just for menus and mainly for CDs.
    I guess I can allow to give it an alternate name like [GENERAL SETTINGS], but what should I do if someone has both [GENERAL SETTINGS] and [CUSTOM CD MENU]...?
  2. Empty lines like registry= can be removed if you want to make it even more minimal.
  3. I guess you need setenv, like:

    Code: Select all

    [BUTTON1]
    buttontext=Stem Roller
    relativepathandfilename=App\StemRoller\StemRoller.exe
    closemenuonclick=1
    setenv=APPDATA|App\fake-appdata
    
    It means Stem Roller will think App\fake-appdata is actually the real appdata folder and should be tricked to put its files and folders there.
  4. Is it possible to change the EXE's icon in X-Launcher? If so, how? Icons are hardcoded to EXE files during compilation time. I guess you can create a shortcut, right click it and choose to change icon.
  5. You've mentioned elsewhere you've found the README annoying. Feel free to suggest how to improve. In fact, since it's open source, you can even to edit it on GitHub, which will submit it to me as a pull request suggestion.

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

Re: AutoRun LWMenu

#229 Post by sl23 »

Thanks for the assistance :)
1. Perhaps you could add a line or two of code to auto replace that? Up to you though.
2. Understood, thanks.
3. Excellent!
4. No, not the X-Launcher, I use Resource Hacker. Not tried with AutoRun yet, but I expect it's probably the same principal.
5.I didn't say it was annoying, I said confusing. Mainly as it sort of focuses on the menu part more and there isn't any examples on how to get started. Not being a programmer, it was difficult understanding it's capabilities. I feel this should be at the top of the page. I can write some bits to add if you like, though never used git hub before so might take a while! lol

6. FR: Could you add variables for the app name please? X-Launcher has some built in variables so you can specify as: "AppName=StemRoller" which then allows: "PathToExe=$Bin$\$AppName$\$AppName$.exe" this makes it a little easier to edit for other apps. Obviously there are many such variables in X-Launcher.

Thank you for your 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

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

Re: AutoRun LWMenu

#230 Post by sl23 »

lwc wrote: Sat May 25, 2024 11:53 am 2. I guess you need setenv, like:

Code: Select all

[BUTTON1]
buttontext=Stem Roller
relativepathandfilename=App\StemRoller\StemRoller.exe
closemenuonclick=1
setenv=APPDATA|App\fake-appdata
It means Stem Roller will think App\fake-appdata is actually the real appdata folder and should be tricked to put its files and folders there.
This doesn't seem to work. I've tried arranging folders and adding that path to AutoRun.inf many times, but the AppData/Roaming/stemroller folder keeps being remade with it's settings. I expect it's just the syntax is wrong somewhere, but I have no idea what I'm doing with this.

Would you ba able to help please? :)
This is my current setup:

Code: Select all

[AutoRun]
open=AutoRun.exe
icon=AutoRun.exe, 0

[CUSTOM CD MENU]
skiptobutton=1

[BUTTON1]
buttontext=Stem Roller
relativepathandfilename=App\StemRoller\StemRoller.exe
closemenuonclick=1
setenv=APPDATA|App\AppData\stemroller
This works and is much easier with X-Launcher, hence my insistance on trying to get that compiled to x64, which worked but leaves an AutoIT error on closing stemroller. I know that once this is working in AutoRun, it will simply be a matter of adjusting for any other app I want to use it for. Hopefully it's not a bug, but user error. :D

How would you use setenv to control other system folders? Some apps store data in ProgramFiles, ProgramData, User/Documents, etc. What are the variables used for these instances? Is there some reference page providing a complete list of such variables? Are they standard Windows Variables?

Thanks.
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: 284
Joined: Tue Jun 26, 2012 10:40 pm
Contact:

Re: AutoRun LWMenu

#231 Post by lwc »

Code: Select all

relativepathandfilename=App\StemRoller\StemRoller.exe
setenv=APPDATA|App\AppData\stemroller
Since you run the program from another folder, it means you basically defined %appdata% as App\StemRoller\App\AppData\stemroller which of course doesn't exist.
What you want should be:

Code: Select all

[AutoRun]
open=AutoRun.exe
icon=AutoRun.exe, 0

[CUSTOM CD MENU]
skiptobutton=1

[BUTTON1]
buttontext=Stem Roller
relativepathandfilename=App\StemRoller\StemRoller.exe
closemenuonclick=1
setenv=APPDATA|..\AppData\stemroller
The .. part means it will go back from App\StemRoller to just App and then enter the specific sub-folder.
sl23 wrote: Wed May 29, 2024 7:03 am How would you use setenv to control other system folders? Some apps store data in ProgramFiles, ProgramData, User/Documents, etc. What are the variables used for these instances? Is there some reference page providing a complete list of such variables? Are they standard Windows Variables?
Yes, standard. You can see them in Wikipedia.
Here's a simple batch code to show you a real time list of all possible Environment variables:

Code: Select all

@echo off
set
pause
Save it as something like showenv.bat and double click to run it.
If you like, I can add this list to the help menu.
Attachments
help menu.png
help menu.png (5.81 KiB) Viewed 2423 times

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

Re: AutoRun LWMenu

#232 Post by sl23 »

Ah I see, so the actual StemRoller.exe is sort of the root path from where you specify the AppData location and NOT the AutoRun.exe folder?

I set it up sort of like X-Launcher to keep things tidy:
Root folder: StemRoller
AutoRun.exe folder: Root folder
StemRoller.exe folder: App
AppData folder: User/AppData/stemroller
Here's my code now, after removing some sub directories for less navigation:

Code: Select all

[AutoRun]
open=AutoRun.exe
icon=AutoRun.exe, 0

[CUSTOM CD MENU]
skiptobutton=1
singlerun=1

[BUTTON1]
buttontext=Stem Roller
relativepathandfilename=App\StemRoller.exe
closemenuonclick=1
setenv=APPDATA|..\User\AppData
But StemRoller still creates the AppData folder instead of using the fake one. Have I done something wrong or is it the launcher?
Do I need to specify just the path to Appdata itself, or the full path, ie the last part, setenv=APPDATA|..\User\AppData\stemroller

Thanks for the help. Yes I agree it would be good to have the variables built in, or if easier, just link to that wiki page? Or add that batch code as a kind of short cut :)

I just checked the menus help, didn't know about that command line syntax, I may have seen it and not realised I may need it.

You could maybe add a INI file or something, with all those variables in? That's probably the simplest way for you isn't it? Whatever you think ;)
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

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

Re: AutoRun LWMenu

#233 Post by -ElCoyot- »

I also suffer a lot with this "setenv=", but I can't figure it out, my brain is already boiling. It would be nice to post an example of a program using "setenv=" here to make it clearer.

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

Re: AutoRun LWMenu

#234 Post by sl23 »

Yeah that's what I meant about examples. If something like my setup was used as a default, I'm sure others could work out how to adjust it to suit. :)

But it would be so much better if these other paths were given such examples too. I don't tend to bother with the registry side of things, as apps that use it aren't really my thing anyway. I do have a couple, but I'd rather stay away from that part.

This is a great little app, but it needs some more documentation for us lesser mortals! :D
And some nice examples. One of the great things about X-Launcher was that you simply put FixAppData=true and it works, better than several other methods too!
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: 284
Joined: Tue Jun 26, 2012 10:40 pm
Contact:

Re: AutoRun LWMenu

#235 Post by lwc »

sl23 wrote: Wed May 29, 2024 12:10 pm Ah I see, so the actual StemRoller.exe is sort of the root path from where you specify the AppData location and NOT the AutoRun.exe folder?
Yes, since many apps can only be run (or run properly) from their own folders for the most part since they expect to find their other files there.

Code: Select all

relativepathandfilename=App\StemRoller.exe
setenv=APPDATA|..\User\AppData
If everything is in c:\something does it mean you have:
  1. c:\something\App\
  2. c:\something\User\AppData
?
If so, it should have worked and it did work for me in other programs, do you have a link for a portable version of Stem Roller for me to try?

With that said, X-Launcher's documentation claims "in general, you cannot change the value [of AppData]...by doing so, the change has no effect on the portable program." They suggest to change USERPROFILE instead (in addition to FixAppData=true), does it mean you indeed changed USERPROFILE in X-Launcher (you didn't mention it)?
If so, you can try this:

Code: Select all

relativepathandfilename=App\StemRoller.exe
setenv=USERPROFILE|..\User
Or maybe both of them:

Code: Select all

relativepathandfilename=App\StemRoller.exe
setenv=USERPROFILE|..\User
setenv=APPDATA|..\User\AppData

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

Re: AutoRun LWMenu

#236 Post by -ElCoyot- »

Here is the program https://www.oo-software.com/en/shutup10 . How do I use "setenv=" instead
of "symlink="?

Code: Select all

[CUSTOM CD MENU]
hidetrayicon=1
skiptobutton=3
blinktaskbarwhendone=1
; netaccess=0

[BUTTON3]
buttontext=OOShutUp10
relativepathandfilename=App\OOSU10.exe
; symlink=%LOCALAPPDATA%\OO Software\|OO Software
; setenv=
backuppath=App

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

Re: AutoRun LWMenu

#237 Post by sl23 »

Thanks for the info.
Yes, you are correct with the paths you specified. They are as follows:

Code: Select all

MyApps\StemRoller\AutoRun.exe
MyApps\StemRoller\App\StemRoller.exe
MyApps\StemRoller\User\AppData\stemroller\
The X-Launcher code I use has slightly different paths, but works. Yes it has the UserProfile set too:
Spoiler!   

Code: Select all

[Setup]
AppName=StemRoller

[FileSystem]
Root=@ScriptDir@
Bin=.\Bin
Lib=.\Lib
Backup=.\Backups

[FileToRun]
PathToExe=$Bin$\$AppName$\$AppName$.exe

[Options]
DeleteTemp=true
MultipleIstances=false
FixAppData=true
RunWait=true
ShowSplash=true
WriteLog=false

[SplashScreen]
TimeOut=1500

[Environment]
USERPROFILE=$Lib$\
It's a pretty generic setup I use for all my apps and it works well.

I did wonder how you could specify more than one setenv= as in Rainmeter code, the only coding I am really used to, you can only specify one line as it will ignore a new key with the same name if in the same section. But that's cleared that part up too :)

Not sure why, but specifying setenv=USERPROFILE|..\User stops the app from opening. This is the same issue I had with SyMenu, which uses a similar approach to portablising apps in this way. The only app I've found to work without issues is X-Launcher, which is why I was so keen on getting it updated.

In SyMenu, you add this:

Code: Select all

USERPROFILE=.\User
APPDATA=.\User\AppData
Which I just tried adding Roaming to the path name and it worked, as well as moving the folder for the apps AppData into a Roaming folder so the path to it in SyMenu is now:

Code: Select all

USERPROFILE=.\User
APPDATA=.\User\AppData\Roaming
This worked for SyMenu, but not for AutoRun. Any idea why? I'm not using the exact same syntax, as I know I need to adjust it to the way AutoRun works.

Btw, there is no portable version of StemRoller, I download the installation file and use Unversal Extractor v2 to get the files. A process I've used for years.
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: 84
Joined: Fri Jan 02, 2015 6:25 am

Re: AutoRun LWMenu

#238 Post by sl23 »

-ElCoyot- wrote: Wed May 29, 2024 9:07 pm Here is the program https://www.oo-software.com/en/shutup10 . How do I use "setenv=" instead
of "symlink="?

Code: Select all

[CUSTOM CD MENU]
hidetrayicon=1
skiptobutton=3
blinktaskbarwhendone=1
; netaccess=0

[BUTTON3]
buttontext=OOShutUp10
relativepathandfilename=App\OOSU10.exe
; symlink=%LOCALAPPDATA%\OO Software\|OO Software
; setenv=
backuppath=App
I tried a similar approach with O&O ShutUp10:

Code: Select all

[BUTTON1]
buttontext=O&O ShutUp10
closemenuonclick=1
relativepathandfilename=OOSU10.exe
setenv=USERPROFILE|User
setenv=LOCALAPPDATA|User\AppData\Local
Not working. The AutoRun.exe is in the same folder as OOSU10.exe.
It opens the app but keeps creating the AppData\Local\OO Software folder.

Again, similar code doesn't work in SyMenu and I also set it up in X-Launcher, none of which works. SYMenu and X-Launcher won't even open the app. So It's likely this app doesn't support being made portable in this way.
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
rbon
Posts: 400
Joined: Wed Mar 28, 2007 2:16 am
Location: Italy

Re: AutoRun LWMenu

#239 Post by rbon »

lwc wrote: Sat May 25, 2024 11:53 am Is it possible to change the EXE's icon in X-Launcher? If so, how? Icons are hardcoded to EXE files during compilation time. I guess you can create a shortcut, right click it and choose to change icon.
These are two snippets from discussion WinPenPack's X-Launcher update?
(my example program was X-LibreOffice.exe, an AutoIt X-Launcher compiled as 64 bit))

-----------------------------------------------------------------
For manage icons You need of 2 (two) programs:
1. IconExtract for Nirsoft https://www.nirsoft.net/utils/iconsext.html for extract all icons (as cumulative file) from official program installer
2. Resource Hacker Portable from PortableApps https://portableapps.com/apps/utilities ... r-portable

Now You have already obtained the program icons and now You can open Resource Hacker for import the icons in X-LibreOffice.exe:
1. open Resource Hacker
2. (menu bar) File -> Open -> X-LibreOffice.exe
3. on left window expand and select Icon Group and select an Icon
4. (menu bar) Action -> Replace icon ... -> Open file with new icon -> (confirm) Icon to replace -> Replace
5. (menu bar) File -> Save (overwrite existing opened file or save with another name)
6. exit from Resource Hacker
7. if You have overwrite the existing opened file, delete X-LibreOffice-original.exe

You can also read on How To Geek a short step-by-step (mini)Tutorial with name How to Modify the Icon of an EXE File https://www.howtogeek.com/75983/stupid- ... .exe-file/
--------------------------------------------------------------------

In Your case open Resource Hacker, replace X-LibreOffice.exe with Autorun_x64.exe and follows previous instructions.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning." - Rick Cook.

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

Re: AutoRun LWMenu

#240 Post by sl23 »

Thanks, I've sorted that out already. I appreciate your advice though :)
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

Post Reply