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

Re: AutoRun LWMenu

#316 Post by lwc »

Hooray!
It should be UTF8 even regardless of drivers, what's the benefit of anything else?
If you open a new Notepad, the default is UTF8. Anything else means working in a non standard way.

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

Re: AutoRun LWMenu

#317 Post by -ElCoyot- »

I put a check mark here, now everything is correct.
2024-7-5 6-40-48.png

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

Re: AutoRun LWMenu

#318 Post by -ElCoyot- »

Is there no way to combine both x32 and x64 versions into one file? It would be more convenient.

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

Re: AutoRun LWMenu

#319 Post by lwc »

Yeah, that's unfortunately not how it works, otherwise PortableFreeware wouldn't have had to have 32 and 64-bit entries for each and every item in the entire database...you can read why here (the comments are interesting too). It seems the only way around it is creating a 32-bit main file and letting it create another file on run-time and launch it.
If I did it, then you'd have a file called autorun.exe which at run-time will secretly create a file like autorun_actual.exe and run it (whereas autorun_actual.exe will be created as 32 or 64 based on what autorun.exe detected).
I'm sure antiviruses will just love like seeing 1 EXE secretly creating another one...
Alternatively I can ship 3 files to begin with, with the main one deciding which actual file to use, but antiviruses may not like it either, and it might lead to confusions.

About your screenshot, that's Notepad++, not Notepad, and even there UTF8 is the default. You must have kept it from an ancient version or changed it to not UTF8 in the past. Anyway, at least your got it correct now, so that's behind us.

So with drivers (which also led to supporting multilingual menus and commands) finally behind us (what a challenging experience), without further adieu it's time for your other request - creating services on the fly!
Can you try it in the latest beta? The new settings' file explains how to use it, it's all combined in service= (no longer services=) that can both create and delete and have multiple entries.

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

Re: AutoRun LWMenu

#320 Post by -ElCoyot- »

I didn't understand how to start the service. There is such a bat.the file that starts the service. You can write a line with this command in service=

@echo off
sc create USBSafelyRemoveService binPath= "E:\Temp\USBSafelyRemove\App\USBSRService.exe"
sc start USBSafelyRemoveService

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

Re: AutoRun LWMenu

#321 Post by lwc »

-ElCoyot- wrote: Sun Jul 07, 2024 8:08 pm I didn't understand how to start the service. There is such a bat.the file that starts the service. You can write a line with this command in service=

@echo off
sc create USBSafelyRemoveService binPath= "E:\Temp\USBSafelyRemove\App\USBSRService.exe"
sc start USBSafelyRemoveService
This BAT file should translate to the minimum of:

Code: Select all

service=USBSafelyRemoveService | USB Safely Remove Service | E:\Temp\USBSafelyRemove\App\USBSRService.exe
Start Mode and Desktop Interaction can optionally be defined too (see screenshot), otherwise I make them Automatic and True as if you wrote:

Code: Select all

service=USBSafelyRemoveService | USB Safely Remove Service | E:\Temp\USBSafelyRemove\App\USBSRService.exe | Automatic | True
An example that changes my defaults:

Code: Select all

service=USBSafelyRemoveService | USB Safely Remove Service | E:\Temp\USBSafelyRemove\App\USBSRService.exe | Manual | False
Note the spaces around | are optional, they just make it more readable.
And you can have multiple service= like:

Code: Select all

service=this | ...
service=that | ...
Attachments
Create method of the Win32_Service class.png

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

Re: AutoRun LWMenu

#322 Post by -ElCoyot- »

In this configuration, I only have the service running, the program itself does not start. And where should I register the removal of the service?

Code: Select all

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

[BUTTON3]
buttontext=USBSafelyRemove
relativepathandfilename=App\USBSafelyRemove.exe
registry=+HKEY_CURRENT_USER\SOFTWARE\SafelyRemove +HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSafelyRemoveService
deletefolders=%ALLUSERSPROFILE%\USBSRService
symlink=%APPDATA%\USBSafelyRemove\|USBSafelyRemove
service=USBSafelyRemoveService|USBSafelyRemoveService|E:\Temp\USBSafelyRemove\App\USBSRService.exe
backuppath=App

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

Re: AutoRun LWMenu

#323 Post by lwc »

It will be deleted automatically upon exiting relativepathandfilename (use service=USBSafelyRemoveService alone to have just the deletion without the creation part).

Not waiting for the program to start must be a clash with skiptobutton.
Can you try it again in the latest beta?

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

Re: AutoRun LWMenu

#324 Post by -ElCoyot- »

It is starting correctly now. But when you close the program, an error appears.
At the same time, the service itself is deleted normally.
Screenshot_240708_190939.png
Screenshot_240708_190939.png (4.44 KiB) Viewed 603 times
[CUSTOM MENU]
hidetrayicon=1
skiptobutton=3
blinktaskbarwhendone=1
singlerun=1
; netaccess=0
; admin=1

[BUTTON3]
buttontext=USBSafelyRemove
relativepathandfilename=App\USBSafelyRemove.exe
registry=+HKEY_CURRENT_USER\SOFTWARE\SafelyRemove +HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSafelyRemoveService
deletefolders=%ALLUSERSPROFILE%\USBSRService
symlink=%APPDATA%\USBSafelyRemove\|USBSafelyRemove
service=USBSafelyRemoveService|USBSafelyRemoveService|E:\Temp\USBSafelyRemove\App\USBSRService.exe
service=USBSafelyRemoveService
backuppath=App

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

Re: AutoRun LWMenu

#325 Post by lwc »

It's simply because you try to delete it twice:

Code: Select all

service=USBSafelyRemoveService|USBSafelyRemoveService|E:\Temp\USBSafelyRemove\App\USBSRService.exe
service=USBSafelyRemoveService
Either have just this:

Code: Select all

service=USBSafelyRemoveService|USBSafelyRemoveService|E:\Temp\USBSafelyRemove\App\USBSRService.exe
which will both create and later delete it.

Or have just this:

Code: Select all

service=USBSafelyRemoveService
which will delete it without creating it first.

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

Re: AutoRun LWMenu

#326 Post by -ElCoyot- »

which will both create and later delete it.
Thank you. Everything is cool

Post Reply