How to make a NSIS launcher
rich.bradshaw (Homepage) - October 29, 2006 - 1:24pm
I have some applications that I want to make portable (Mainly Maple - a symbolic algebra package). They currently run fine off of my flash drive with no modification, but they are writing to registry and using various dlls etc. Will a launcher using NSIS be enough to get this working at a simple level?
In a launcher I found on these forums for CCleaner, the launcher also registers and unregisters all the dll files associated with the program - do I need to do this to make it portable?
In this section of code,
CheckRunning: Sleep 2000 FindProcDLL::FindProc "$PROGRAMEXECUTABLE" Pop $R0 StrCmp $R0 "1" CheckRunning TheEnd
How do you choose a value to sleep? What is that number? Is it 2000 seconds or cycles or what? Are we waiting for the program to properly load up? Does this code also detect when the program ends?
Finally, what does this do?
Function "GetParameters" Push $R0 Push $R1 Push $R2 StrCpy $R0 $CMDLINE 1 StrCpy $R1 '"' StrCpy $R2 1 StrCmp $R0 '"' loop StrCpy $R1 ' ' ; we're scanning for a space instead of a quote loop: StrCpy $R0 $CMDLINE 1 $R2 StrCmp $R0 $R1 loop2 StrCmp $R0 "\" "" "nofile" IntOp $2 $R2 + 1 nofile: StrCmp $R0 "" loop2 IntOp $R2 $R2 + 1 Goto loop loop2: IntOp $R0 $R2 - $2 IntOp $R0 $R0 - 4 StrCpy $R7 $CMDLINE $R0 $2 ; we save the filename loop2b: IntOp $R2 $R2 + 1 StrCpy $R0 $CMDLINE 1 $R2 StrCmp $R0 " " loop2b StrCpy $R0 $CMDLINE "" $R2 Pop $R2 Pop $R1 Exch $R0 FunctionEnd
Thanks a lot, I am keen to start creating launchers for a few simple/complex programs!