NSIS - Tips

1 minute read

I create a lot of windows application to make things easier for my customers. The simple act of coping a file from an email to a certain directory can become the most complicated tasks for a certain type of customer.

I use an Scriptable Install System provided by NullSoft called NSIS (Nullsoft Scriptable Install System). Ita great system that just plain works. Its free, open source, and can be used for commercial products, Great plugin system, Dead simple for simple things, ect.

The manual has lots of examples and function documentation to help get you started.

Over the last few years of using this program I have created a library of useful little snippets of code. Free free to comment with your own.

Opening a directory

ExecShell "open" '"$INSTDIR"' BringToFront

Registering/unregistering personal ActiveX files

UnRegDLL "$SYSDIR\spin32.ocx" RegDLL "$SYSDIR\spin32.ocx"

Checking if a process is running This uses the FindProcDLL::FindProc plug-in (here also):

StrCpy $1 "mybin.exe" FindProcDLL::FindProc "$1" ;0 = Process was not found ;1 = Process was found ;605 = Unable to search for process ;606 = Unable to identify system type ;607 = Unsupported OS ;632 = Process name is invalid StrCmp $R0 0 0 error File "mybin.exe" ; Can't use a variable Goto end error: MessageBox MB_OK|MB_ICONSTOP "The application $1 is currently running. Press CTRL-ALT-DEL to display the list of running processes." Quit end:

Leave a comment