- ; example2.nsi
- ;
- ; This script is based on example1.nsi, but adds uninstall support
- ; and (optionally) start menu shortcuts.
- ;
- ; It will install notepad.exe into a directory that the user selects,
- ;
- ; The name of the installer
- Name "PeerCast v0.1214 Licensed"
- Function Kill
- FindWindow $0 PeerCast
- IsWindow $0 Kill Skip
- Kill:
- MessageBox MB_OKCANCEL "PeerCast is already running, press OK to close it and continue installing." IDCANCEL Die
- SendMessage $0 16 0 0
- Sleep 3000
- Goto Skip
- Die:
- Abort
- Skip:
- FunctionEnd
- Function un.Kill
- FindWindow $0 PeerCast
- IsWindow $0 Kill Skip
- Kill:
- MessageBox MB_OKCANCEL "PeerCast is already running, press OK to close it and continue uninstalling." IDCANCEL Die
- SendMessage $0 16 0 0
- Sleep 3000
- Goto Skip
- Die:
- Abort
- Skip:
- FunctionEnd
- Function .onInit
- SetOutPath $TEMP
- File /oname=spltmp.bmp "peercast.bmp"
- ; optional
- ; File /oname=spltmp.wav "my_splashshit.wav"
- ; File /oname=spltmp.exe "C:program filesnsissplash.exe"
- ; ExecWait '"$TEMPspltmp.exe" 1000 $HWNDPARENT $TEMPspltmp'
- ; Delete $TEMPspltmp.exe
- ; Delete $TEMPspltmp.bmp
- ; Delete $TEMPspltmp.wav
- Call Kill
- FunctionEnd
- Function un.onInit
- Call un.Kill
- FunctionEnd
- ; The file to write
- OutFile "peercast-lic-win32.exe"
- ; The default installation directory
- InstallDir $PROGRAMFILESPeerCast
- ; Registry key to check for directory (so if you install again, it will
- ; overwrite the old one automatically)
- InstallDirRegKey HKLM SOFTWAREPeerCast "Install_Dir"
- ; The text to prompt the user to enter a directory
- ComponentText "This will install PeerCast on your computer. Select which optional things you want installed."
- ; The text to prompt the user to enter a directory
- DirText "Choose a directory to install in to:"
- ;InstType "Normal"
- ;InstType "NT Service"
- ; The stuff to install
- Section "PeerCast (required)"
- StrCpy $1 "$INSTDIRhtml"
- SetOutPath "$1en"
- File "....htmlen*.*"
- SetOutPath "$1enimages"
- File "....htmlenimages*.*"
- SetOutPath "$1ja"
- File "....htmlja*.*"
- SetOutPath "$1jaimages"
- File "....htmljaimages*.*"
- SetOutPath "$1de"
- File "....htmlde*.*"
- SetOutPath "$1deimages"
- File "....htmldeimages*.*"
- SetOutPath "$1fr"
- File "....htmlfr*.*"
- SetOutPath "$1frimages"
- File "....htmlfrimages*.*"
- SetOutPath "$INSTDIR"
- File "peercast.exe"
- File "oggcap.exe"
- ; add files / whatever that need to be installed here.
- WriteRegStr HKEY_LOCAL_MACHINE "SOFTWAREPeerCast" "" "$INSTDIR"
- WriteRegStr HKEY_LOCAL_MACHINE "SoftwareMicrosoftWindowsCurrentVersionUninstallPeerCast" "DisplayName" "PeerCast (remove only)"
- WriteRegStr HKEY_LOCAL_MACHINE "SoftwareMicrosoftWindowsCurrentVersionUninstallPeerCast" "UninstallString" '"$INSTDIRuninst.exe"'
- ; register peercast:// URI
- WriteRegStr HKEY_CLASSES_ROOT "peercast" "" "URL:PeerCast Protocol"
- WriteRegStr HKEY_CLASSES_ROOT "peercast" "URL Protocol" ""
- WriteRegStr HKEY_CLASSES_ROOT "peercastDefault Icon" "" "$INSTDIRpeercast.exe"
- WriteRegStr HKEY_CLASSES_ROOT "peercastshellopencommand" "" '"$INSTDIRpeercast.exe" -inifile "$INSTDIRpeercast.ini" -url "%1"'
- ; write out uninstaller
- WriteUninstaller "$INSTDIRuninstall.exe"
- SectionEnd
- Section /o "Run on Startup"
- CreateShortCut "$SMSTARTUPPeerCast.lnk" "$INSTDIRpeercast.exe" ""
- SectionEnd
- ;Section "PeerCast NT Service"
- ; SectionIn 2
- ; File "instsrv.exe"
- ; File "srvany.exe"
- ; ExecWait '"$INSTDIRinstsrv.exe" PeerCast "$INSTDIRsrvany.exe"'
- ; ExecWait '"$INSTDIRinstsrv.exe" PeerCast c:srvany.exe'
- ; WriteRegStr HKEY_LOCAL_MACHINE "SYSTEMCurrentControlSetServicesPeerCastParameters" "AppDirectory" "$INSTDIR"
- ; WriteRegStr HKEY_LOCAL_MACHINE "SYSTEMCurrentControlSetServicesPeerCastParameters" "Application" "$INSTDIRpeercast.exe"
- ;SectionEnd
- ; optional section
- Section "Add Start Menu shortcuts"
- ; File "peercast.hlp"
- CreateDirectory "$SMPROGRAMSPeerCast"
- CreateShortCut "$SMPROGRAMSPeerCastStart PeerCast.lnk" "$INSTDIRpeercast.exe"
- CreateShortCut "$SMPROGRAMSPeerCastStop PeerCast.lnk" "$INSTDIRpeercast.exe" "-kill"
- CreateShortCut "$SMPROGRAMSPeerCastOggCap Video Broadcaster.lnk" "$INSTDIRoggcap.exe"
- CreateShortCut "$SMPROGRAMSPeerCastYellow Pages.lnk" "http://yp.peercast.org"
- CreateShortCut "$SMPROGRAMSPeerCastOnline Help.lnk" "http://www.peercast.org/help.php"
- CreateShortCut "$SMPROGRAMSPeerCastLatest News.lnk" "http://www.peercast.org/forum/viewforum.php?f=9"
- CreateShortCut "$SMPROGRAMSPeerCastUninstall.lnk" "$INSTDIRuninstall.exe"
- CreateDirectory "$SMPROGRAMSPeerCastLinks"
- CreateShortCut "$SMPROGRAMSPeerCastLinksPeerCast Home.lnk" "http://www.peercast.org"
- CreateShortCut "$SMPROGRAMSPeerCastLinksPeerCast Forums.lnk" "http://www.peercast.org/forum"
- CreateShortCut "$SMPROGRAMSPeerCastLinksPeerCast Download.lnk" "http://www.peercast.org/download.php"
- CreateShortCut "$SMPROGRAMSPeerCastLinksReport a bug.lnk" "http://www.peercast.org/bugs.php"
- SectionEnd
- Function .onInstSuccess
- MessageBox MB_YESNO "Installation has finished. Would you like to run PeerCast now?" IDNO NoExe
- Exec '"$INSTDIRpeercast.exe"'
- NoExe:
- FunctionEnd
- ; begin uninstall settings/section
- UninstallText "This will uninstall PeerCast from your system"
- Section "Uninstall"
- ; add delete commands to delete whatever files/registry keys/etc you installed here.
- ; Delete "$INSTDIRuninst.exe"
- ;ExecWait '"$INSTDIRinstsrv.exe" PeerCast REMOVE'
- RMDir /r "$SMPROGRAMSPeerCast"
- Delete "$SMSTARTUPPeerCast.lnk"
- DeleteRegKey HKEY_CLASSES_ROOT "peercast"
- DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWAREPeerCast"
- DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWAREMicrosoftWindowsCurrentVersionUninstallPeerCast"
- Delete "$INSTDIRpeercast.exe"
- Delete "$INSTDIRpeercast.ini"
- Delete "$INSTDIRplay.pls"
- Delete "$INSTDIRuninstall.exe"
- RMDir /r "$INSTDIRhtml"
- SectionEnd ; end of uninstall section
- ; eof