You are here

General Launcher Portable 0.5.0.0 Development Test 1

4 posts / 0 new
Last post
computerfreaker
computerfreaker's picture
Offline
Last seen: 13 years 2 months ago
Developer
Joined: 2009-08-11 11:24
General Launcher Portable 0.5.0.0 Development Test 1

Application: General Launcher (note: there is no website for this app as of 2010-02-18)
Category: Utilities
Description: General Launcher is a simple, INI-based, way to launch multiple programs. It's especially useful for autorunning apps from a USB drive, since autorun.inf only supports launching a single app.

Download General Launcher Portable 0.5 Development Test 1 [397 KB download / 287 KB installed]
(MD5: 97991be2b25d1a01502e007f51671b9d)

Release Notes:

0.5.0.0, Development Test 1 (2010-02-20):

  • Improvement: did a bit of code cleanup
  • Replaced the old, GPL-violating icon with a new, GPL-compliant one (thanks for creating the new icon, varxtis!)

0.3.0.0, Development Test 1 (2010-02-18):
Initial release

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 4 months ago
Joined: 2007-04-15 21:08
Concerning the code: It's not

Concerning the code:
It's not an INI format you're using; thus your data file should not really use the INI extension. But then, maybe you should use an INI format, due to your use of ExecShell (file and parameters are separate arguments):

[Launch1]
Run=whatever.ext
Parameters=whatever parameters
Hide=true

Currently any quoted paths or paths with parameters will break (it'll try to execute the file name including the quotes or parameters), and using any extension without an open command available in the registry won't work (command should be "").

(Hide=true was just an idea that popped into my head - you can use it to hide windows that you don't want to see; it will work with command line windows and GUI windows alike though so caveat user.)

You've also got a lot of junk from launchers left in there which you just don't need. Your use of StrReplace is sub-optimal, it's more efficient to set environment variables once and then ExpandEnvStrings will take care of them all. I've rewritten most of it here (and got rid of some strings which are already available - %PROFILE% is already available as %USERPROFILE% and %WINDIR% is already there). I also submit that almost none of those variables will be useful for simply launching an application; %DRIVE% would tend to be all that's needed, almost all the rest are overkill.

!define VER "0.4.0.0"
Name "General Launcher"
OutFile ..\..\GeneralLauncher.exe
Icon ..\..\App\AppInfo\appicon.ico
Caption "General Launcher"
VIProductVersion "${VER}"
VIAddVersionKey ProductName "General Launcher"
VIAddVersionKey Comments "Launch any number of applications at once."
VIAddVersionKey CompanyName "computerfreaker"
VIAddVersionKey LegalCopyright "computerfreaker"
VIAddVersionKey FileDescription "General Launcher"
VIAddVersionKey FileVersion "${VER}"
VIAddVersionKey ProductVersion "${VER}"
VIAddVersionKey InternalName "General Launcher"
VIAddVersionKey LegalTrademarks ""
VIAddVersionKey OriginalFilename "GeneralLauncher.exe"
SilentInstall Silent
AutoCloseWindow True
RequestExecutionLevel user
!include LogicLib.nsh
!include TextFunc.nsh
!include FileFunc.nsh

!macro SetEnvStr VAR VAL
	System::Call `Kernel32::SetEnvironmentVariable(t"${VAR}",t"${VAL}")`
!macroend
!define SetEnvStr "!insertmacro SetEnvStr"

Section
	; Load config file
	${GetParameters} $9
	${IfThen} $9 == "" ${|} StrCpy $9 $EXEDIR\Data\GeneralLauncher.ini ${|}
	${IfNot} ${FileExists} $9
		MessageBox MB_OK "Configuration file $9 not found!"
		Abort
	${EndIf}

	; Set handy environment strings
	${GetRoot} $EXEDIR $0
	${SetEnvStr} DRIVE $0
	${SetEnvStr} DESKTOP $DESKTOP
	${SetEnvStr} DOCUMENTS $DOCUMENTS
	${SetEnvStr} MUSIC $MUSIC
	${SetEnvStr} PICTURES $PICTURES
	${SetEnvStr} PROGRAMFILES $PROGRAMFILES
	${SetEnvStr} PROGRAMFILES32 $PROGRAMFILES32
	${SetEnvStr} PROGRAMFILES64 $PROGRAMFILES64
	${SetEnvStr} QUICKLAUNCH $QUICKLAUNCH
	${SetEnvStr} SMPROGRAMS $SMPROGRAMS
	${SetEnvStr} SMSTARTUP $SMSTARTUP
	${SetEnvStr} STARTMENU $STARTMENU
	${SetEnvStr} SYSDIR $SYSDIR
	${SetEnvStr} VIDEOS $VIDEOS

	${SetEnvStr} DESKTOP $DESKTOP

	; Run the programs
	StrCpy $0 1
	${Do}
		ClearErrors
		ReadINIStr $1 $9 Launch$0 Run
		${IfThen} ${Errors} ${|} ${ExitDo} ${|}
		ReadINIStr $2 $9 Launch$0 Parameters
		ReadINIStr $3 $9 Launch$0 Hide
		ExpandEnvStrings $1 $1
		ExpandEnvStrings $2 $2
		${If} $3 == true
			ExecShell "" $1 $2 SW_HIDE
		${Else}
			ExecShell "" $1 $2
		${EndIf}
		Sleep 1000
		IntOp $0 $0 + 1
	${Loop}
SectionEnd

Concerning the icon:

License
CC Attribution-Noncommercial 3.0
Commercial usage: Not allowed

Thus if you wish to use that icon, App\AppInfo\appinfo.ini:[License]->CommercialUse should not be true but false. (This is due not to the CC-NC which is distribution but the CU:NA specified in the next line.) You'll also have issues with the GPL.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

computerfreaker
computerfreaker's picture
Offline
Last seen: 13 years 2 months ago
Developer
Joined: 2009-08-11 11:24
Re:

Chris MorganConcerning the code:
It's not an INI format you're using; thus your data file should not really use the INI extension.

Yeah, I thought about that, but I can't think of another text-file type that's generally used for data storage, is recognized as data storage, and opens with a text editor instead of getting the Windows "What do you want to do with this file?" box. TXT was an option, but it's rarely (if ever) used for data storage, and just plain doesn't look good, so I went with INI.

Chris MorganBut then, maybe you should use an INI format, due to your use of ExecShell (file and parameters are separate arguments):

Exec wouldn't work for anything but applications, so I went with ExecShell instead. (Pretty sure I left a note in the comments about that, but just in case I forgot...)
I'd like to go back to an INI-based format, but I'd really like to use ${ForEachINIPair} and other code from PAL then (I've got a working, INI-based general launcher, if you want to see the code - there's probably 2-3 macros I borrowed from PAL), and that may not be desirable.

Chris MorganCurrently any quoted paths or paths with parameters will break (it'll try to execute the file name including the quotes or parameters), and using any extension without an open command available in the registry won't work (command should be "").

I was aware of the parameters issue, but not the "open" issue. That worked for all the file types I tried, so it all looked good.
I'll fix that.

Chris Morgan(Hide=true was just an idea that popped into my head - you can use it to hide windows that you don't want to see; it will work with command line windows and GUI windows alike though so caveat user.)

Pretty good idea, especially for command-line windows.

Chris MorganYou've also got a lot of junk from launchers left in there which you just don't need.

I had the same feeling, although I couldn't pinpoint anything specific. I'll take another look over the source.

Chris MorganYour use of StrReplace is sub-optimal, it's more efficient to set environment variables once and then ExpandEnvStrings will take care of them all.

I tried ReadEnvStr, but NSIS kept erroring out because it already had values for those variables; ExpandEnvStrings gave me grief, too, until I figured out how I was supposed to use it. StrReplace was the best option at that point, since I couldn't figure out any other way to get the environment variables properly translated.

Chris MorganI've rewritten most of it here

Thanks, I'll look that over.

Chris Morgan(and got rid of some strings which are already available - %PROFILE% is already available as %USERPROFILE% and %WINDIR% is already there)

Any way of seeing which strings are and which strings aren't there? I had all kinds of trouble with that last night, and finally decided to define everything myself and call it a day.

Chris MorganI also submit that almost none of those variables will be useful for simply launching an application; %DRIVE% would tend to be all that's needed, almost all the rest are overkill.

Sorry, but I've got to disagree.
Although the General Launcher will probably be primarily used (as is intended) to work with autorun.inf, in which case %DRIVE% would be enough, I'm expecting at least a few users to need something more than that.

Chris MorganConcerning the icon:

License
CC Attribution-Noncommercial 3.0
Commercial usage: Not allowed

Thus if you wish to use that icon, App\AppInfo\appinfo.ini:[License]->CommercialUse should not be true but false. (This is due not to the CC-NC which is distribution but the CU:NA specified in the next line.) You'll also have issues with the GPL.

So if I have the icon in there, I have to turn off CommercialUse. And if I turn off CommercialUse, the GPL is broken, right?
Time to get a new icon, which is a shame, because that was a good-looking icon.
EDIT: how's this look?

License-Disclaimer-
- I don't really care what you do with these files,
just don't try to claim them as your own creations.

So, the bottom line here: redesign the app & get a new icon?

"The question I would like to know, is the Ultimate Question of Life, the Universe and Everything. All we know about it is that the Answer is Forty-two, which is a little aggravating."

computerfreaker
computerfreaker's picture
Offline
Last seen: 13 years 2 months ago
Developer
Joined: 2009-08-11 11:24
Updated 2010-02-20

Updated 2010-02-20, see above for details.

There are still some code problems with this release; I'll resolve them soon.

"The question I would like to know, is the Ultimate Question of Life, the Universe and Everything. All we know about it is that the Answer is Forty-two, which is a little aggravating."

Log in or register to post comments