Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.