Make a custom bsplayer install with NSIS (v2.0b4)
Ok awhile ago I asked if anyone could help me with making a custom install for bsplayer (to include with a full size movie on a cd). I got no helpful replies. Since then I've figured it out and am posting the setup script here in case anyone else ever has the same problem needing a solution. This installer looks for previously installed versions of BSPlayer (by looking to see if a key in the registry exists), automatically registers the *.avi/*.mpg/*.mpeg extentions, when uninstalled restores them, and adds preset options for the player to the registry (eg. No border/OSD Font/etc.). It includes only four files (to make it as light as possible), but you can add however many you wish:
- bsrendv.dll
- bplay.exe
- skins\pancake.bsz
- skins\MacOS X Aqua_small.bsz
Hope this helps somebody!
NSIS (v2.0b4) SETUP SCRIPT FOR BSPLAYER:
========================
!define PRODUCT_NAME "BSPlayer"
!define PRODUCT_VERSION "0.86.501"
!define PRODUCT_PUBLISHER "BST"
!define PRODUCT_WEB_SITE "http://www.bsplayer.org"
SetCompressor bzip2
!include "MUI.nsh"
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\bplay-install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\bplay-uninstall.ico"
!define MUI_COMPONENTSPAGE_SMALLDESC
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
Name "${PRODUCT_NAME}"
Caption "${PRODUCT_NAME} ${PRODUCT_VERSION} Setup"
OutFile "BSPlay_setup.exe"
InstallDir "$PROGRAMFILES\BSPlayer"
InstallDirRegKey HKCU "Software\BST\bsplayer" "AppPath"
AutoCloseWindow false
ShowInstDetails hide
ShowUnInstDetails hide
Section "BSPlayer (required)" SEC01
SectionIn RO
SetOutPath "$INSTDIR"
SetOverwrite ifnewer
File "D:\Temp\bsplayer\bsrendv.dll"
File "D:\Temp\bsplayer\bplay.exe"
SetOutPath "$INSTDIR\skins\"
File "D:\Temp\bsplayer\skins\pancake.bsz"
File "D:\Temp\bsplayer\skins\WinDVDplus2.bsz"
SectionEnd
;I renamed the MacOS X Aqua_small.bsz skin to WinDVDplus2.bsz so it would load as the default skin when BSPlayer is started. You can also do this by adding a registry string to the registry.
Section "Start Menu + Desktop Shortcuts" SEC02
CreateShortCut "$SMPROGRAMS\BSPlayer.lnk" "$INSTDIR\bplay.exe"
CreateShortCut "$DESKTOP\BSPlayer.lnk" "$INSTDIR\bplay.exe"
SectionEnd
Section -Post
WriteUninstaller "$INSTDIR\uninst.exe"
UNRegDLL "$INSTDIR\bsrendv.dll"
WriteRegStr HKCU "Software\BST\bsplayer" "exts" ".AVI;.MPG"
WriteRegStr HKCU "Software\BST\bsplayer" "OSDFont" "238;Arial;12;1;16777215"
WriteRegDWORD HKCU "Software\BST\bsplayer" "AutoPlay" "1"
WriteRegDWORD HKCU "Software\BST\bsplayer" "mvp" "1"
WriteRegDWORD HKCU "Software\BST\bsplayer" "NoBord" "1"
WriteRegDWORD HKCU "Software\BST\bsplayer" "osdbg" "c0c0c0"
WriteRegDWORD HKCU "Software\BST\bsplayer" "RegE" "1"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\App Paths\bplay.exe" "" "$INSTDIR\bplay.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninsta ll\${PRODUCT_NAME}" "DisplayName" "$(^Name)"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninsta ll\${PRODUCT_NAME}" "UninstallString" "$INSTDIR\uninst.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninsta ll\${PRODUCT_NAME}" "DisplayIcon" "$INSTDIR\bplay.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninsta ll\${PRODUCT_NAME}" "DisplayVersion" "${PRODUCT_VERSION}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninsta ll\${PRODUCT_NAME}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninsta ll\${PRODUCT_NAME}" "Publisher" "${PRODUCT_PUBLISHER}"
SectionEnd
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SEC01} "Install BSPlayer on your computer."
!insertmacro MUI_DESCRIPTION_TEXT ${SEC02} "Create Start Menu and Desktop Items."
!insertmacro MUI_FUNCTION_DESCRIPTION_END
Function .onInstSuccess
Exec $INSTDIR\bplay.exe
FunctionEnd
Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
FunctionEnd
Function un.onInit
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
Abort
Push $0
loop:
FindWindow $0 "BSPlayer"
IntCmp $0 0 done
SendMessage $0 16 0 0
Sleep 100
Goto loop
done:
Pop $0
FunctionEnd
Section Uninstall
ExecWait '"$INSTDIR\bplay.exe" -UNIS'
UNRegDLL "$INSTDIR\bsrendv.dll"
Delete "$INSTDIR\uninst.exe"
Delete "$INSTDIR\bplay.exe"
Delete "$INSTDIR\bsrendv.dll"
Delete "$INSTDIR\skins\pancake.bsz"
Delete "$INSTDIR\skins\WinDVDplus2.bsz"
Delete "$DESKTOP\BSPlayer.lnk"
Delete "$SMPROGRAMS\BSPlayer.lnk"
RMDir "$INSTDIR\skins\"
RMDir "$INSTDIR"
DeleteRegKey HKCR "Applications\bplay.exe\"
DeleteRegKey HKCU "Software\BST\bsplayer\"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninsta ll\${PRODUCT_NAME}"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\App Paths\bplay.exe"
SetAutoClose false
SectionEnd
|