You are here

How to make a NSIS launcher

6 posts / 0 new
Last post
rich.bradshaw
Offline
Last seen: 11 years 5 months ago
Joined: 2006-10-05 08:41
How to make a NSIS launcher

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?
Will just deleting all the registry keys it makes at the end work?

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!

Rich

Ryan McCue
Ryan McCue's picture
Offline
Last seen: 15 years 1 month ago
Joined: 2006-01-06 21:27
Well

Simple way: Use Lapwing
Harder way with launchers:
do I need to do this to make it portable?
Yes. You must make sure no DLLs are left on the computer.

How do you choose a value to sleep? What is that number? Is it 2000 seconds or cycles or what?
The number is in milliseconds, so that value is 2 seconds.

Are we waiting for the program to properly load up?
We are waiting for the program to do what it's supposed to.

Does this code also detect when the program ends?
Well,

		FindProcDLL::FindProc "$PROGRAMEXECUTABLE"
		Pop $R0                     
		StrCmp $R0 "1" CheckRunning TheEnd

Does, however the easier way is

ExecWait "$EXEDIR\Some.exe"
;This is not executed until the program quits:
Exec "Some\Other\App.exe"

Oh and that final function gets the parameters passed to the app:
e.g.: "C:\App.exe" -some_param
----
R McCue
Cube Games
People who didn't need people needed people around to know that they were
the kind of people who didn't need people.
(Maskerade)

"If you're not part of the solution, you're part of the precipitate."

rich.bradshaw
Offline
Last seen: 11 years 5 months ago
Joined: 2006-10-05 08:41
How do you write a relative

How do you write a relative path in Lapwing? I have Lapwing in k:\system\lapwing, and maple is in k:\system\maple\bin.win\cwmaple.exe . I am writing the path for Lapwing as \..\maple\bin.win\cwmaple.exe . It picks up the icon but still comes up with an error...

Steve Lamerton
Steve Lamerton's picture
Offline
Last seen: 11 years 2 months ago
Developer
Joined: 2005-12-10 15:22
Yeh,

relative paths are not supported at the moment. Look out for them in the next version along with a host of updates.

Yours

Steve Lamerton

The Liberta Project

rich.bradshaw
Offline
Last seen: 11 years 5 months ago
Joined: 2006-10-05 08:41
Oh OK. How does Lapwing

Oh OK. How does Lapwing work - what does it actually do, and what limitations should I expect? Will it make any program portable?

Ryan McCue
Ryan McCue's picture
Offline
Last seen: 15 years 1 month ago
Joined: 2006-01-06 21:27
What I meant was

You need to put the app in the Lapwing directory then use something like /App/App.exe
----
R McCue
Cube Games
People who didn't need people needed people around to know that they were
the kind of people who didn't need people.
(Maskerade)

"If you're not part of the solution, you're part of the precipitate."

Topic locked