; Script generated by the HM NIS Edit Script Wizard. ; HM NIS Edit Wizard helper defines !define PRODUCT_NAME "DigiClock" !define PRODUCT_VERSION "1.0" !define PRODUCT_PUBLISHER "Auddy's" !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\DigiClock.exe" !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" !define PRODUCT_UNINST_ROOT_KEY "HKLM" !define PRODUCT_STARTMENU_REGVAL "NSIS:StartMenuDir" ; MUI 1.67 compatible ------ !include "MUI.nsh" ; MUI Settings !define MUI_ABORTWARNING !define MUI_UNABORTWARNING !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\myicoi.ico" !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\myicou.ico" !define MUI_WELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\Setupmodern17.bmp" !define MUI_UNWELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\Setupmodern17.bmp" !define MUI_HEADERIMAGE !define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\wizRight.bmp" !define MUI_HEADERIMAGE_RIGHT ;!define MUI_HEADERIMAGE_BITMAP_NOSTRETCH !define MUI_COMPONENTSPAGE_SMALLDESC ; Welcome page !insertmacro MUI_PAGE_WELCOME ; License page !define MUI_LICENSEPAGE_CHECKBOX !insertmacro MUI_PAGE_LICENSE "E:\MyVB\Digit\license.txt" ; Components page !insertmacro MUI_PAGE_COMPONENTS ; Directory page !insertmacro MUI_PAGE_DIRECTORY ; Start menu page var ICONS_GROUP ;!define MUI_STARTMENUPAGE_NODISABLE !define MUI_STARTMENUPAGE_DEFAULTFOLDER "DigiClock" !define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}" !define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}" !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${PRODUCT_STARTMENU_REGVAL}" !insertmacro MUI_PAGE_STARTMENU Application $ICONS_GROUP ;custom page Page Custom CustomPageC ; Instfiles page !insertmacro MUI_PAGE_INSTFILES ; Finish page !define MUI_FINISHPAGE_RUN "$INSTDIR\DigiClock.exe" !insertmacro MUI_PAGE_FINISH ; Uninstaller pages !insertmacro MUI_UNPAGE_WELCOME !insertmacro MUI_UNPAGE_CONFIRM ;MUI_UNPAGE_COMPONENTS ;MUI_UNPAGE_DIRECTORY !insertmacro MUI_UNPAGE_INSTFILES !insertmacro MUI_UNPAGE_FINISH ; Language files !insertmacro MUI_LANGUAGE "English" ; MUI end ------ ReserveFile "ioC.ini" !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS ;-------------------------------- ;Variables Var INI_VALUE1 Var INI_VALUE2 BrandingText /TRIMRIGHT " Copyright (C) Dipak Auddy, 2004. " XPStyle on Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" OutFile "DigiClock10.exe" InstallDir "$PROGRAMFILES\DigiClock" InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" "" ShowInstDetails hide ShowUnInstDetails hide InstType /COMPONENTSONLYONCUSTOM InstType "Full" InstType "Compact" Section "Program Files" SEC01 SectionIn 1 2 3 RO SetOutPath "$INSTDIR" SetOverwrite on File /a "E:\MyVB\Digit\DigiClock.exe" CreateDirectory "$SMPROGRAMS\$ICONS_GROUP" CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\DigiClock.lnk" "$INSTDIR\DigiClock.exe" ;Read a value from an InstallOptions INI file !insertmacro MUI_INSTALLOPTIONS_READ $INI_VALUE1 "ioC.ini" "Field 2" "State" !insertmacro MUI_INSTALLOPTIONS_READ $INI_VALUE2 "ioC.ini" "Field 3" "State" ;Create shortcut if check box was checked StrCmp $INI_VALUE1 "1" "" +2 CreateShortCut "$DESKTOP\DigiClock.lnk" "$INSTDIR\DigiClock.exe" StrCmp $INI_VALUE2 "1" "" +2 CreateShortCut "$QUICKLAUNCH\DigiClock.lnk" "$INSTDIR\DigiClock.exe" ;end INI.... File /a "E:\MyVB\Digit\license.txt" CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\License.lnk" "$INSTDIR\license.txt" SectionEnd Section "Pictures" SEC02 SectionIn 1 2 SetOutPath "$INSTDIR\Bitmaps" SetOverwrite on File /a "E:\MyVB\Digit\YellowP.bmp" File /a "E:\MyVB\Digit\Yellow.bmp" File /a "E:\MyVB\Digit\PuncRed.bmp" File /a "E:\MyVB\Digit\DigitsBlu.bmp" File /a "E:\MyVB\Digit\PuncBlu.bmp" File /a "E:\MyVB\Digit\DigitsRed.bmp" File /a "E:\MyVB\Digit\DigitsGrn.bmp" File /a "E:\MyVB\Digit\PuncGrn.bmp" SectionEnd Section "Source" SEC03 SectionIn 1 SetOutPath "$INSTDIR\Source" SetOverwrite on File /a "E:\MyVB\Digit\DigiClock.vbp" File /a "E:\MyVB\Digit\Form1.frx" File /a "E:\MyVB\Digit\Form1.frm" File /a "E:\MyVB\Digit\RegFunc.bas" SectionEnd Section -AdditionalIcons CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Uninstall DigiClock.lnk" "$INSTDIR\uninst.exe" SectionEnd Section -Post WriteUninstaller "$INSTDIR\uninst.exe" WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\DigiClock.exe" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\DigiClock.exe" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "${PRODUCT_STARTMENU_REGVAL}" "$ICONS_GROUP" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}" ;My keys... WriteRegDword HKLM "Software\Auddy's\DigiClock\Settings" "Digit Color" 2 WriteRegDword HKLM "Software\Auddy's\DigiClock\Settings" "Startup" 1 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "DigiClock" "$INSTDIR\DigiClock.exe" ;--- SectionEnd ; Section descriptions !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} "Main Executables" !insertmacro MUI_DESCRIPTION_TEXT ${SEC02} "Bitmaps used to build DigiClcok" !insertmacro MUI_DESCRIPTION_TEXT ${SEC03} "Full Source Code of DigiClock" !insertmacro MUI_FUNCTION_DESCRIPTION_END Function .onInit Call GetWindowsVersion Pop $R0 StrCmp $R0 "98" +6 "" StrCmp $R0 "2000" +5 "" StrCmp $R0 "2003" +4 "" StrCmp $R0 "xp" +3 "" MessageBox MB_OK "Only Supports Windows 98, 2000 and XP" Abort ;Extract InstallOptions INI files !insertmacro MUI_INSTALLOPTIONS_EXTRACT "ioC.ini" FunctionEnd LangString TEXT_IO_TITLE ${LANG_ENGLISH} "Select Additional Tasks" LangString TEXT_IO_SUBTITLE ${LANG_ENGLISH} "Which Additional Tasks should be performed?" Function CustomPageC !insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)" !insertmacro MUI_INSTALLOPTIONS_DISPLAY "ioC.ini" 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 FunctionEnd Var f1 Var f2 Var f3 Var f4 Function un.onGUIEnd FileClose $f1 FileClose $f2 FileClose $f3 FileClose $f4 FunctionEnd Function GetWindowsVersion Push $R0 Push $R1 ReadRegStr $R0 HKLM \ "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion IfErrors 0 lbl_winnt ; we are not NT ReadRegStr $R0 HKLM \ "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber StrCpy $R1 $R0 1 StrCmp $R1 '4' 0 lbl_error StrCpy $R1 $R0 3 StrCmp $R1 '4.0' lbl_win32_95 StrCmp $R1 '4.9' lbl_win32_ME lbl_win32_98 lbl_win32_95: StrCpy $R0 '95' Goto lbl_done lbl_win32_98: StrCpy $R0 '98' Goto lbl_done lbl_win32_ME: StrCpy $R0 'ME' Goto lbl_done lbl_winnt: StrCpy $R1 $R0 1 StrCmp $R1 '3' lbl_winnt_x StrCmp $R1 '4' lbl_winnt_x StrCpy $R1 $R0 3 StrCmp $R1 '5.0' lbl_winnt_2000 StrCmp $R1 '5.1' lbl_winnt_XP StrCmp $R1 '5.2' lbl_winnt_2003 lbl_error lbl_winnt_x: StrCpy $R0 "NT $R0" 6 Goto lbl_done lbl_winnt_2000: Strcpy $R0 '2000' Goto lbl_done lbl_winnt_XP: Strcpy $R0 'XP' Goto lbl_done lbl_winnt_2003: Strcpy $R0 '2003' Goto lbl_done lbl_error: Strcpy $R0 '' lbl_done: Pop $R1 Exch $R0 FunctionEnd Section Uninstall ReadRegStr $ICONS_GROUP ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "${PRODUCT_STARTMENU_REGVAL}" Delete "$INSTDIR\uninst.exe" Delete "$INSTDIR\Source\RegFunc.bas" Delete "$INSTDIR\Source\Form1.frm" Delete "$INSTDIR\Source\Form1.frx" Delete "$INSTDIR\Source\DigiClock.vbp" Delete "$INSTDIR\Bitmaps\PuncGrn.bmp" Delete "$INSTDIR\Bitmaps\DigitsGrn.bmp" Delete "$INSTDIR\Bitmaps\DigitsRed.bmp" Delete "$INSTDIR\Bitmaps\PuncBlu.bmp" Delete "$INSTDIR\Bitmaps\DigitsBlu.bmp" Delete "$INSTDIR\Bitmaps\PuncRed.bmp" Delete "$INSTDIR\Bitmaps\Yellow.bmp" Delete "$INSTDIR\Bitmaps\YellowP.bmp" Delete "$INSTDIR\license.txt" Delete "$INSTDIR\DigiClock.exe" Delete "$SMPROGRAMS\$ICONS_GROUP\Uninstall DigiClock.lnk" Delete "$SMPROGRAMS\$ICONS_GROUP\License.lnk" Delete "$QUICKLAUNCH\DigiClock.lnk" Delete "$DESKTOP\DigiClock.lnk" Delete "$SMPROGRAMS\$ICONS_GROUP\DigiClock.lnk" RMDir "$SMPROGRAMS\$ICONS_GROUP" RMDir "$INSTDIR\Source" RMDir "$INSTDIR\Bitmaps" RMDir "$INSTDIR" ;My keys... DeleteRegKey HKLM "Software\Auddy's\DigiClock" DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "DigiClock" ;--- DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}" ;SetRebootFlag true ;BUG! will not clear TEMP files on Win9x. ;As the above flag is not working properly in Win9x, we are going to try some really terible ;things now...In short, we are going to add some entries in WININIT.INI manually to delete ;temp-files that left over. (It might not work, but that means nothing!!? From NSIS point ;of view, updating the INI file properly is all we care! ) ;The INI in interest, is automatically created as NSIS has to write it's own uninstaller ;entry in there.....so we begin.... ;There are only 4 files (usually) left over... FileOpen $f1 "$PLUGINSDIR\InstallOptions.dll" "r" FileOpen $f2 "$PLUGINSDIR\ioSpecial.ini" "r" FileOpen $f3 "$PLUGINSDIR\modern-wizard.bmp" "r" FileOpen $f4 "$PLUGINSDIR\modern-header.bmp" "r" Delete /REBOOTOK "$PLUGINSDIR\*.*" RMDir /REBOOTOK "$PLUGINSDIR" SetReBootFlag true SectionEnd