Skip to content

Instantly share code, notes, and snippets.

@englishextra
Created June 17, 2016 11:38
Show Gist options
  • Save englishextra/70e4b8e70ae971a0af3ba92c1dddc611 to your computer and use it in GitHub Desktop.
Save englishextra/70e4b8e70ae971a0af3ba92c1dddc611 to your computer and use it in GitHub Desktop.
irrverbsscr-win32-ia32.nsi
;https://gist.github.com/englishextra/70e4b8e70ae971a0af3ba92c1dddc611
; Script generated by the ISS2NSI program.
; Generated from: D:\server\sources\englishextra-app\englishextra-app-win32-ia32.iss
;change INNO's {pf32} to NSIS's $PROGRAMFILES32
;change INNO's {pf64} to NSIS's $PROGRAMFILES64
; fix englishextra-app\./.dist\ to englishextra-app\.dist\
; change Unins000.exe to uninstall.exe
;1 warning:
;!warning: MUI_LANGUAGE should be inserted after the MUI_[UN]PAGE_* macros (macro:MUI_LANGUAGE:8)
;This is a bug in MUI v1. It should be fixed in the next version.
;You can just ignore this warning but if you want to remove it
;you can add !insertmacro MUI_DEFAULT MUI_PAGE_UNINSTALLER_PREFIX "" before inserting the language macros.
;http://forums.winamp.com/showthread.php?t=382600
;convert this script to DOS\Windows Windows-1251 if you have Cyrillic text
;otherwise keep ANSI encodig
; MUI 1.66 compatible
!include "MUI2.nsh"
!include "x64.nsh"
Unicode true
!define MUI_ABORTWARNING
;http://nsis.sourceforge.net/Docs/Modern%20UI/Readme.html
!define MUI_SPECIALBITMAP "WizModernImage.bmp"
!define MUI_ICON "insticon.ico"
!define MUI_UNICON "win-uninstall.ico"
;http://forums.winamp.com/showthread.php?t=208627
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_RIGHT
!define MUI_HEADERIMAGE_BITMAP "WizModernSmallImage150x57.bmp"
!define MUI_HEADERIMAGE_UNBITMAP "WizModernSmallImage150x57.bmp"
;https://nsis-dev.github.io/NSIS-Forums/html/t-238019.html
!define MUI_WELCOMEPAGE_TITLE_3LINES
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_INSTFILES
;http://forums.winamp.com/showthread.php?t=317689
!define MUI_FINISHPAGE_RUN "$SYSDIR\IrregularVerbs.scr"
#!define MUI_FINISHPAGE_RUN_TEXT "Run the program now"
!define MUI_FINISHPAGE_TITLE_3LINES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_INSTFILES
;http://nsis.sourceforge.net/Examples/Modern%20UI/MultiLanguage.nsi
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "Russian"
!insertmacro MUI_LANGUAGE "Ukrainian"
;http://nsis.sourceforge.net/A_simple_installer_with_start_menu_shortcut_and_uninstaller
!define APPID "{21838ED2-0C77-455F-8779-D391270D14E8}"
!define APPNAME "Irregular Verbs Screensaver"
!define VERSION "0.1.1"
!define ABOUTURL "https://irrverbsscr.codeplex.com/"
!define HELPURL "https://irrverbsscr.codeplex.com/documentation"
!define UPDATEURL "https://irrverbsscr.codeplex.com/releases"
!define PUBLISHER "englishextra.github.io"
!define COPYRIGHT "© 2016 englishextra.github.io <[email protected]>"
Name "${APPNAME}"
BrandingText "${COPYRIGHT}"
OutFile "irrverbsscr-win32-ia32-setup.exe"
InstallDir "$PROGRAMFILES32\${APPNAME}"
ShowInstDetails show
ShowUnInstDetails show
Function .onInit
#MessageBox MB_YESNO|MB_ICONQUESTION "This will install ${APPNAME}. Do you wish to continue?" IDYES +2
#Abort
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd
Section -Files
${If} ${RunningX64}
SetOutPath "$WINDIR\SysWOW64"
${Else}
SetOutPath "$SYSDIR"
${EndIf}
File "IrregularVerbs.scr"
SetOutPath "$INSTDIR"
File "favicon.ico"
SectionEnd
Section -Icons
CreateDirectory "$DESKTOP"
${If} ${RunningX64}
CreateShortCut "$DESKTOP\${APPNAME}.lnk" "$WINDIR\SysWOW64\IrregularVerbs.scr" "" "$INSTDIR\favicon.ico" "" "" "" ""
${Else}
CreateShortCut "$DESKTOP\${APPNAME}.lnk" "$SYSDIR\IrregularVerbs.scr" "" "$INSTDIR\favicon.ico" "" "" "" ""
${EndIf}
CreateDirectory "$SMPROGRAMS\${APPNAME}"
${If} ${RunningX64}
CreateShortCut "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk" "$WINDIR\SysWOW64\IrregularVerbs.scr" "" "$INSTDIR\favicon.ico" "" "" "" ""
${Else}
CreateShortCut "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk" "$SYSDIR\IrregularVerbs.scr" "" "$INSTDIR\favicon.ico" "" "" "" ""
${EndIf}
CreateShortCut "$SMPROGRAMS\${APPNAME}\Uninstall ${APPNAME}.lnk" "$INSTDIR\uninstall.exe"
CreateShortCut "$SMPROGRAMS\${APPNAME}\Website.lnk" "https://englishextra.github.io/"
SectionEnd
Section -Registry
WriteRegStr HKCU "Control Panel\Desktop" "ScreenSaveActive" "1"
${If} ${RunningX64}
WriteRegStr HKCU "Control Panel\Desktop" "SCRNSAVE.EXE" "$WINDIR\SysWOW64\IRREGU~1.SCR"
${Else}
WriteRegStr HKCU "Control Panel\Desktop" "SCRNSAVE.EXE" "$SYSDIR\IRREGU~1.SCR"
${EndIf}
SectionEnd
Section -PostInstall
# http://nsis.sourceforge.net/A_simple_installer_with_start_menu_shortcut_and_uninstaller
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPID}" "DisplayName" "${APPNAME}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPID}" "UninstallString" "$INSTDIR\uninstall.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPID}" "DisplayIcon" "$INSTDIR\favicon.ico"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPID}" "Publisher" "${PUBLISHER}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPID}" "URLInfoAbout" "${ABOUTURL}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPID}" "URLUpdateInfo" "${UPDATEURL}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPID}" "HelpLink" "${HELPURL}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPID}" "DisplayVersion" "${VERSION}"
WriteUninstaller "$INSTDIR\uninstall.exe"
SectionEnd
Section -Run
#${If} ${RunningX64}
# Exec "$WINDIR\SysWOW64\IrregularVerbs.scr"
#${Else}
# Exec "$SYSDIR\IrregularVerbs.scr"
#${EndIf}
SectionEnd
#### Uninstaller code ####
Function un.onInit
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove ${APPNAME} and all of its components?" IDYES +2
Abort
FunctionEnd
Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "${APPNAME} was successfully removed from your computer."
FunctionEnd
Section Uninstall
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPID}"
DeleteRegValue HKCU "Control Panel\Desktop" "ScreenSaveActive"
DeleteRegValue HKCU "Control Panel\Desktop" "SCRNSAVE.EXE"
DeleteRegKey /ifempty HKCU "Control Panel\Desktop"
Delete "$INSTDIR\uninstall.exe"
Delete "$SMPROGRAMS\${APPNAME}\Website.lnk"
Delete "$SMPROGRAMS\${APPNAME}\Uninstall ${APPNAME}.lnk"
Delete "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk"
Delete "$DESKTOP\${APPNAME}.lnk"
Delete "$INSTDIR\favicon.ico"
${If} ${RunningX64}
Delete "$WINDIR\SysWOW64\IrregularVerbs.scr"
${Else}
Delete "$SYSDIR\IrregularVerbs.scr"
${EndIf}
RMDir "$SMPROGRAMS\${APPNAME}"
RMDir "$INSTDIR"
SetAutoClose true
SectionEnd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment