Created
July 10, 2015 08:24
-
-
Save antonmaju/fa588e849c1562ef729b to your computer and use it in GitHub Desktop.
Hello World 3.nsi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!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