Page 1 of 1

.bat launcher for ImgBurn...

Posted: Mon Mar 15, 2010 4:47 pm
by Onesimus Prime
Here's a simple .bat launcher for ImgBurn. Its advantage is that, not only does it launch ImgBurn with the "/portable" parameter, but you can associate filetypes with the .bat (like *.iso, etc.) using eXpresso/C.A.F.E./Coffee and it can still portably launch ImgBurn...

Code: Select all

@echo off
cls
Title ImgBurn portable launcher

IF "%~x1" == "" (start /D "%~dp0App" ImgBurn.exe /portable) ELSE (start /D "%~dp0App" ImgBurn.exe /portable /mode write /src "%~f1")
(where ImgBurn and all its files/folders are in an "App" subfolder, to make it less likely for the user to accidentally click on the .exe instead of the .bat launcher...
You can replace the word "App" the two times it happens in the above script with your own folder name, or remove it entirely if you want to keep the .bat in the same folder as ImgBurn.)

Re: .bat launcher for ImgBurn...

Posted: Mon Mar 15, 2010 10:02 pm
by Ruby
Hey Onesimus Prime, are you aware that ImgBurn does not need the '/portable' parameter, as long as the file ImgBurn.ini
contains:

Code: Select all

[Settings]
PortableMode=1
and is in the same folder as ImgBurn.exe.

Re: .bat launcher for ImgBurn...

Posted: Mon Mar 15, 2010 10:25 pm
by Onesimus Prime
guinness disupted this in the program's comments, but Hydaral just posted an answer there which I think may be correct (but the next question is - how much has to be done manually?). Perhaps one of the 'regulars' here has got some testing to do to get a definitive answer!

Thanks for bringing it up, Ruby!

*edit* - without the other switches implemented in the batch file (/mode write /src "%~f1"), I'm not sure portable file association would work with a normally-launched, but portable, ImgBurn.exe?

Re: .bat launcher for ImgBurn...

Posted: Mon Mar 15, 2010 11:00 pm
by guinness
OK, so my testing of Applications has got better so I thought I would try again.

With the INI file (as suggested by Ruby and in the Database Entry) it wrote log files to %APPDATA%\ImgBurn. I then deleted this folder and started again with the \portable CLI switch and it wrote log files again, weird. So I then edited the INI and substituted %APPDATA\ImgBurn plus other folder names to a relative format by adding a "." and launched without the parameter. All folders were created in the Application folder! :)

TESTED: Portable

So in a new INI paste the following.

Code: Select all

[Settings]
PortableMode=1
FILELOCATIONS_GraphDataFiles=.\Graph Data Files\
FILELOCATIONS_ImageFiles=.\Documents\
FILELOCATIONS_LogFiles=.\Log Files\
FILELOCATIONS_ProjectFiles=.\Project Files\
FILELOCATIONS_QueueFiles=.\Queue Files\

Re: .bat launcher for ImgBurn...

Posted: Mon Mar 15, 2010 11:21 pm
by Ruby
I should have been a little more specific; starting with a blank ImgBurn.ini
except for:

Code: Select all

[Settings]
PortableMode=1

Re: .bat launcher for ImgBurn...

Posted: Mon Mar 15, 2010 11:39 pm
by guinness
Uh! That's what I did, but when it writes the settings to the INI on the first run the following (below) use an absolute path (C:\Documents and Settings\Username\Application Data\USERNAME\ImgBurn\" not a relative. So these should be pasted in the empty INI file too.

Code: Select all

FILELOCATIONS_GraphDataFiles=.\Graph Data Files\
FILELOCATIONS_ImageFiles=.\Documents\
FILELOCATIONS_LogFiles=.\Log Files\
FILELOCATIONS_ProjectFiles=.\Project Files\
FILELOCATIONS_QueueFiles=.\Queue Files\
Ruby please Test with out the following additions and see if it was just my machine.

Re: .bat launcher for ImgBurn...

Posted: Tue Mar 16, 2010 12:06 am
by Ruby
OK just tested it, and it appears that if you start ImgBurn with a blank ini containg:

Code: Select all

[Settings]
PortableMode=1
it doesn't write to the registry but it does indeed create a folder in %appdata%, and restarting with /portable does not correct this behaviour, however if you start with a blank ini containing the 2 lines of code and pass the /portable parameter it saves everything in ImgBurn's folder.
Also in the UI settings it will show the full absolute path but in the ini they are indeed relative.
So in conclusion the /portable parameter is only needed on first run to set the paths relative to ImgBurn.

Re: .bat launcher for ImgBurn...

Posted: Tue Mar 16, 2010 11:05 am
by Ruby
guinness, I noticed in your code above you have:

Code: Select all

FILELOCATIONS_ImageFiles=.\Documents\
This will more than likely create a Documents folder in ImgBurn's folder.
The default created by ImgBurn is:

Code: Select all

FILELOCATIONS_ImageFiles=.\Image Files\

Re: .bat launcher for ImgBurn...

Posted: Tue Mar 16, 2010 12:00 pm
by guinness
Weird, because mine was "%APPDATA%\My Documents" but I deleted the "My" and replaced the %APPDATA% location with "."

But I agree .\Image Files\ seems more appropriate considering the name of the the INI Key.

Re: .bat launcher for ImgBurn...

Posted: Tue Mar 16, 2010 12:26 pm
by Ruby
Like I stated in a previous post, if you delete everything in the ImgBurn.ini except for:

Code: Select all

[Settings]
PortableMode=1
and then start ImgBurn with the /portable parameter all the paths will bet set relative in the ini.
Note: The UI Tools> Settings> File Locations will still show absolute paths.
Once set, the /portable parameter is no longer needed.

Re: .bat launcher for ImgBurn...

Posted: Fri Mar 26, 2010 7:46 am
by Lupo73
But so the bat file is still needed or not?

I think a good solution could be also to use a unique setting folder like this:

[Settings]
PortableMode=1
FILELOCATIONS_GraphDataFiles=.\Settings\Graphics\
FILELOCATIONS_ImageFiles=.\Settings\Images\
FILELOCATIONS_LogFiles=.\Settings\Logs\
FILELOCATIONS_ProjectFiles=.\Settings\Projects\
FILELOCATIONS_QueueFiles=.\Settings\Queues\

Re: .bat launcher for ImgBurn...

Posted: Fri Mar 26, 2010 9:18 am
by Onesimus Prime
"But so the bat file is still needed or not?"

As implied in one of my posts above (thread post #3), I think that if you want to use portable file association via eXpresso/Coffee/C.A.F.E., associating CD image files with the bat is still the way to go as it would pass the necessary parameters to ImgBurn. But I wouldn't mind being proven wrong! :lol: