Skip to content

Instantly share code, notes, and snippets.

@antonmaju
Created July 10, 2015 08:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save antonmaju/fa588e849c1562ef729b to your computer and use it in GitHub Desktop.
Save antonmaju/fa588e849c1562ef729b to your computer and use it in GitHub Desktop.
Hello World 3.nsi
!define PRODUCT_NAME "Hello World 2"
!include "MUI.nsh"
!include "LogicLib.nsh"
; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\user.ico"
; Language files
!insertmacro MUI_LANGUAGE "English"
; Reserve files
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
installdir $DESKTOP
Name "${PRODUCT_NAME}"
OutFile "Hello world 3.exe"
BrandingText "My Third NSIS File"
ShowInstDetails show
var curStatus
!macro writeRegistry
WriteRegStr HKLM "Software\Dummy COmpany\Hello World" "String Value" $curStatus
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" "Hello World 3" $EXEPATH
!macroEnd
!macro readRegistry
ReadRegStr $curStatus HKLM "Software\Dummy COmpany\Hello World" "String Value"
!macroEnd
!macro deleteRegistry
DeleteRegKey HKLM "Software\Dummy COmpany\Hello World"
DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" "Hello World 3"
!macroEnd
!macro printLocation
messagebox MB_OK $EXEPATH
!macroEnd
!macro doTaskOne
messagebox MB_OK "Task One"
!macroEnd
!macro doTaskTwo
messagebox MB_OK "Task Two"
!macroEnd
section
setOutPath $INSTDIR
!insertmacro readRegistry
${If} $curStatus == ""
strcpy $curStatus "1"
${EndIf}
${While} $curStatus != "3"
${If} $curStatus == "1"
!insertmacro doTaskOne
strcpy $curStatus "2"
!insertmacro writeRegistry
reboot
${ElseIf} $curStatus == "2"
!insertmacro doTaskTwo
strcpy $curStatus "3"
!insertmacro writeRegistry
${EndIf}
${EndWhile}
!insertmacro deleteRegistry
sectionEnd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment