In this last post about NSIS I am going to describe how to use some of the most useful plugins which will allow you create a pretty decent and featurefull installer for windows.
- Checking for adminstrator privileges:
userInfo::getAccountType
Pop $0
StrCmp $0 “Admin” +3MessageBox MB_OK “Debe tener privilegios de administrador para correr este programa de instalación: $0″ReturnStrCmp $0 “Admin” +3
MessageBox MB_OK “You need Administrator privileges: $0″
Return
This chunk of code will pop up a windows with the propoer notification. The StrCmp sentence compares the $0 variable poped from the stack against “Admin” and if they are equal continue the execution with the 3rd line of code, the one below Return.
- Downloading and Executing, e.g. an external installer:
NSISdl::download /TIMEOUT=30000 “http://www.advansen.com/this/is/a/test/advansen.msi” “$INSTDIR\advansen.msi”
Pop $R0 ;Get the return value
StrCmp $R0 “success” +3
MessageBox MB_OK “Download failed: $R0″
Quit
ExecWait ’”msiexec” /i “$INSTDIR\advansen.msi” /quiet’
