Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- !include "MUI2.nsh"
- !include "nsDialogs.nsh"
- ;--------------------------------
- ; General Attributes
- Name "YT Channel Downloader"
- OutFile "ytchandl_installer.exe"
- InstallDir "$PROGRAMFILES\YT Channel Downloader"
- InstallDirRegKey HKLM "Software\YT Channel Downloader" "InstallDir"
- ShowInstDetails hide
- ShowUninstDetails hide
- BrandingText "QuickNode"
- ;--------------------------------
- ; Variables
- Var DesktopShortcut
- Var StartMenuShortcut
- ;--------------------------------
- ; Interface Settings
- !define MUI_ABORTWARNING
- !define MUI_ICON "icon.ico"
- !define MUI_UNICON "icon.ico"
- ;--------------------------------
- ; Pages
- !insertmacro MUI_PAGE_WELCOME
- !insertmacro MUI_PAGE_DIRECTORY
- Page custom ShortcutPageCreate ShortcutPageLeave
- !insertmacro MUI_PAGE_INSTFILES
- !insertmacro MUI_PAGE_FINISH
- !insertmacro MUI_UNPAGE_CONFIRM
- !insertmacro MUI_UNPAGE_INSTFILES
- !insertmacro MUI_UNPAGE_FINISH
- ;--------------------------------
- ; Languages
- !insertmacro MUI_LANGUAGE "English"
- ;--------------------------------
- ; Installer Sections
- Section "Install"
- SetOutPath $INSTDIR
- File "ytchandl.exe"
- WriteUninstaller "$INSTDIR\uninstall.exe"
- SectionEnd
- ;--------------------------------
- ; Description for Add/Remove Programs
- VIProductVersion "0.3.3.0"
- VIAddVersionKey "ProductName" "YT Channel Downloader"
- VIAddVersionKey "CompanyName" "QuickNode"
- VIAddVersionKey "FileDescription" "YT Channel Downloader Installer"
- VIAddVersionKey "FileVersion" "1.0.0.0"
- VIAddVersionKey "LegalCopyright" "Copyright © QuickNode 2023-2024. Licensed under the MIT License."
- ;--------------------------------
- ; Uninstaller Sections
- Section "Uninstall"
- ; Remove shortcuts
- Delete "$DESKTOP\YT Channel Downloader.lnk"
- Delete "$SMPROGRAMS\YT Channel Downloader.lnk"
- ; Remove files and uninstaller
- Delete "$INSTDIR\uninstall.exe"
- Delete "$INSTDIR\ytchandl.exe"
- ; Remove registry keys
- DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\YT Channel Downloader"
- DeleteRegKey HKLM "Software\YT Channel Downloader"
- ; Remove installation directory
- RMDir "$INSTDIR"
- SectionEnd
- ;--------------------------------
- ; Functions for Shortcut Creation
- Function ShortcutPageCreate
- nsDialogs::Create 1018
- Pop $0
- ${NSD_CreateCheckBox} 0 0 100% 10u "Create a Desktop shortcut"
- Pop $DesktopShortcut
- ${NSD_CreateCheckBox} 0 12u 100% 10u "Create a Start Menu shortcut"
- Pop $StartMenuShortcut
- nsDialogs::Show
- FunctionEnd
- Function ShortcutPageLeave
- ${NSD_GetState} $DesktopShortcut $0
- StrCmp $0 ${BST_CHECKED} 0 +2
- StrCpy $DesktopShortcut "true"
- ${NSD_GetState} $StartMenuShortcut $0
- StrCmp $0 ${BST_CHECKED} 0 +2
- StrCpy $StartMenuShortcut "true"
- ; Create shortcuts if selected
- ${If} $DesktopShortcut == "true"
- CreateShortcut "$DESKTOP\YT Channel Downloader.lnk" "$INSTDIR\ytchandl.exe"
- ${EndIf}
- ${If} $StartMenuShortcut == "true"
- CreateShortcut "$SMPROGRAMS\YT Channel Downloader.lnk" "$INSTDIR\ytchandl.exe"
- ${EndIf}
- FunctionEnd
- ;--------------------------------
- ; Add uninstall information to registry
- Section -Post
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\YT Channel Downloader" "DisplayName" "YT Channel Downloader"
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\YT Channel Downloader" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\YT Channel Downloader" "DisplayIcon" "$INSTDIR\ytchandl.exe"
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\YT Channel Downloader" "DisplayVersion" "0.3.3.0"
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\YT Channel Downloader" "Publisher" "QuickNode.net"
- WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\YT Channel Downloader" "EstimatedSize" 52041
- SectionEnd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement