home *** CD-ROM | disk | FTP | other *** search
/ Chip 2003 November / Chip_2003-11_cd1.bin / software / dave / dqsd.exe / src / search.nsi < prev   
Text File  |  2002-12-22  |  13KB  |  359 lines

  1. ; search.nsi
  2. ;
  3. ; Installs Dave's Quick Search Deskbar
  4. ;
  5.  
  6. ; The name of the installer
  7. Name "Dave's Quick Search Deskbar"
  8.  
  9. ; What is the minimum required version of IE?
  10. !Define IE_MAJOR_REQUIRED  5
  11. !Define IE_MINOR_REQUIRED  5
  12. !Define HOW_TO_TURN_ON_TOOLBAR "Right-click in your taskbar and select$\n$\n    Toolbar > Add Quick Search...$\n$\nto add the Quick Search Deskbar to your taskbar."
  13. !Define TITLE_AND_COPYRIGHT "Dave's Quick Search Deskbar$\nCopyright (c) 2002 David Bau$\nDistributed under the terms of the$\nGNU General Public License, Version 2"
  14. !Define DQSD_CLSID "{226b64e8-dc75-4eea-a6c8-abcb4d1d37ff}"
  15. !Define DQSD_TITLE "Dave's Quick Search Deskbar"
  16.  
  17. ; Silent install
  18. DirShow hide
  19. CRCCheck on
  20. SetDatablockOptimize on
  21. Icon search.ico
  22. SilentInstall silent
  23. ;ShowInstDetails show
  24.  
  25. ; The file to write
  26. OutFile "..\dqsd.exe"
  27.  
  28. ; The default installation directory
  29. InstallDir "$PROGRAMFILES\Quick Search Deskbar"
  30.  
  31. ; Registry key to check for directory (so if you install again, it will
  32. ; overwrite the old one automatically)
  33. InstallDirRegKey HKCR "CLSID\${DQSD_CLSID}" "InstallDir"
  34.  
  35. ; The text to prompt the user to enter a directory
  36. DirText "Choose a directory to install in to:"
  37.  
  38. ; The stuff to install
  39. Section "Quick Search Deskbar (required)"
  40.  
  41.   ; Set output path to the installation directory.
  42.   SetOutPath $INSTDIR
  43.  
  44.   ; Confirm that the user really does want to install  
  45.   MessageBox MB_YESNO|MB_ICONINFORMATION|MB_DEFBUTTON2 "This will install ${DQSD_TITLE}.  Would you like to continue?" IDYES userconfirmedinstall
  46.   Abort
  47.   userconfirmedinstall:
  48.  
  49.   ; Verify that they've got the correct version of IE installed.
  50.   GetDLLVersion "shdocvw.dll" $1 $4
  51.   IntOp $2 $1 & 0xffff0000
  52.   IntOp $2 $2 / 0x00010000
  53.   IntOp $3 $1 & 0x0000ffff
  54.   IntOp $5 $4 & 0xffff0000
  55.   IntOp $5 $5 / 0x00010000
  56.   IntOp $6 $4 & 0x0000ffff
  57.   DetailPrint 'IE Version: $2.$3.$5.$6: OK'
  58.   IntCmp ${IE_MAJOR_REQUIRED} $2 ieMajorVersionOK ieVersionOK ieVersionNotOK
  59.   ieMajorVersionOK:
  60.   IntCmp ${IE_MINOR_REQUIRED} $3 ieVersionOK ieVersionOK ieVersionNotOK
  61.  
  62.   ieVersionNotOK:
  63.     MessageBox MB_YESNO|MB_ICONEXCLAMATION|MB_DEFBUTTON2 "This version of ${DQSD_TITLE} requires IE version ${IE_MAJOR_REQUIRED}.${IE_MINOR_REQUIRED} or higher.  You are currently running version $2.$3.$\n$\nWould you like to continue with the installation anyway?" IDYES ieVersionOK
  64.     Abort
  65.     
  66.   ieVersionOK:
  67.  
  68.   ; Old versions to delete
  69. ;  UnRegDLL $INSTDIR\DQSDTools.dll
  70. ;  Delete /REBOOTOK $INSTDIR\DQSDTools.dll
  71.   UnRegDLL $INSTDIR\dqsdt253.dll
  72.   Delete /REBOOTOK $INSTDIR\dqsdt253.dll
  73.   UnRegDLL $INSTDIR\dqsdt254.dll
  74.   Delete /REBOOTOK $INSTDIR\dqsdt254.dll
  75.   UnRegDLL $INSTDIR\dqsdt255.dll
  76.   Delete /REBOOTOK $INSTDIR\dqsdt255.dll
  77.   UnRegDLL $INSTDIR\dqsdt257.dll
  78.   Delete /REBOOTOK $INSTDIR\dqsdt257.dll
  79.   UnRegDLL $INSTDIR\dqsdt258.dll
  80.   Delete /REBOOTOK $INSTDIR\dqsdt258.dll
  81.  
  82.   ; install new DLL
  83.   SetOverwrite try
  84.   ClearErrors
  85.   File "..\DQSDTools.dll"
  86.   IfErrors seeifsame register
  87.  
  88.   ; If was unable to upgrade, see if files are the same anyway
  89.   seeifsame:
  90.   ClearErrors
  91.   GetDLLVersionLocal "..\DQSDTools.dll" $1 $2
  92.   GetDLLVersion $INSTDIR\DQSDTools.dll $3 $4
  93.   IfErrors isdifferent
  94.   IntCmpU $1 $3 test1 isdifferent isdifferent
  95.   test1:
  96.   IntCmpU $2 $4 test2 isdifferent isdifferent
  97.   test2:
  98.   ClearErrors
  99.   GetFileTimeLocal "..\DQSDTools.dll" $1 $2
  100.   GetFileTime $INSTDIR\DQSDTools.dll $3 $4
  101.   IfErrors isdifferent
  102.   IntCmpU $1 $3 test3 isdifferent isdifferent
  103.   test3:
  104.   IntCmpU $2 $4 register isdifferent isdifferent
  105.  
  106.   SetOverwrite on
  107.  
  108.   ; If different, install as another name and rename to correct file on reboot
  109.   isdifferent:
  110.   File /oname=DQSDTools.dll.ins "..\DQSDTools.dll"
  111.   Rename /REBOOTOK "$INSTDIR\DQSDTools.dll.ins" "$INSTDIR\DQSDTools.dll"
  112.  
  113.   ; We can register the dll and continue
  114.   register:
  115.   RegDLL $INSTDIR\DQSDTools.dll
  116.  
  117.   ; Determine if this is an upgrade
  118.   StrCpy $8 "The Deskbar has been upgraded.  $\nIf the search bar is already present $\non your taskbar, right-click on $\nthe handle to the left of the search bar $\nand select 'Refresh' to reload it.  $\nIf the search bar is not present, $\n${HOW_TO_TURN_ON_TOOLBAR}$\n$\n${TITLE_AND_COPYRIGHT}"
  119.   IfFileExists "$INSTDIR\search.htm" upgradebar
  120.   StrCpy $8 "The Deskbar has been installed.$\n$\n${HOW_TO_TURN_ON_TOOLBAR}$\n$\n${TITLE_AND_COPYRIGHT}"
  121.   upgradebar:
  122.  
  123.  
  124.   WriteUninstaller "$INSTDIR\uninstall.exe"
  125.  
  126.   ; Put files there
  127.   File "..\ChangeLog.txt"
  128.   File "..\aliases.txt"
  129.   File "..\calculate.js"
  130.   File "..\calendar.js"
  131.   File "..\categoryExpander.htc"
  132.   File "..\clock.js"
  133.   File "..\defer_tools.js"
  134.   File "..\helpbox.js"
  135.   File "..\helpmenu.js"
  136.   File "..\history.js"
  137.   File "..\holidays.ausnsw.xml"
  138.   File "..\holidays.fr.xml"
  139.   File "..\holidays.ca.xml"
  140.   File "..\holidays.it.xml"
  141.   File "..\holidays.nl.NL.xml"
  142.   File "..\holidays.nl.EN.xml"
  143.   File "..\holidays.sg.xml"
  144.   File "..\holidays.us.xml"
  145.   File "..\loader.js"
  146.   File "..\maximized.htm"
  147.   File "..\preferences.js"
  148.   File "..\readme.txt"
  149.   File "..\savesearchsettings.js"
  150.   File "..\search.css"
  151.   File "..\search.htm"
  152.   File "..\strings.js"
  153.   File "..\tools.js"
  154.   File "..\translate.js"
  155.   File "..\version.js"
  156.   File "..\version.xml"
  157.   File "..\versiondialog.htm"
  158.   File "..\xplocalsearch.css"
  159.   File "..\xptoolbarbot.bmp"
  160.   File "..\xptoolbartop.bmp"
  161.   SetOutPath "$INSTDIR\searches"
  162.   File "..\searches\*.xml"
  163.   SetOutPath "$INSTDIR\src"
  164.   File "search.ico"
  165.   File "search.nsi"
  166.   File "build.cmd"
  167.   File "clean.cmd"
  168.   File "scrub.cmd"
  169.   File "dqsd.xml"
  170.   SetOutPath "$INSTDIR\src\DQSDTools"
  171.   File "DQSDTools\DQSDTools.cpp"
  172.   File "DQSDTools\DQSDTools.def"
  173.   File "DQSDTools\DQSDTools.dep"
  174.   File "DQSDTools\DQSDTools.dsp"
  175.   File "DQSDTools\DQSDTools.dsw"
  176.   File "DQSDTools\DQSDTools.idl"
  177.   File "DQSDTools\DQSDTools.mak"
  178.   File "DQSDTools\DQSDTools.rc"
  179.   File "DQSDTools\Launcher.cpp"
  180.   File "DQSDTools\Launcher.h"
  181.   File "DQSDTools\Launcher.rgs"
  182.   File "DQSDTools\MenuBuilder.rgs"
  183.   File "DQSDTools\MenuBuilder.h"
  184.   File "DQSDTools\MenuBuilder.cpp"
  185.   File "DQSDTools\KeyboardHook.h"
  186.   File "DQSDTools\KeyboardHook.cpp"
  187.   File "DQSDTools\License.txt"
  188.   File "DQSDTools\StdAfx.cpp"
  189.   File "DQSDTools\StdAfx.h"
  190.   File "DQSDTools\Utilities.h"
  191.   File "DQSDTools\Utilities.cpp"
  192.   File "DQSDTools\resource.h"
  193.  
  194.   ; Create files with user preferences if they doesn't exist
  195.   SetOverwrite off
  196.   SetOutPath "$INSTDIR"
  197.   File "..\localaliases.txt"
  198.   File "..\mrumenu.txt"
  199.   File "..\localsearch.css"
  200.   File "..\localprefs.js"
  201.   SetOverwrite on
  202.   
  203.   ; Create subdirectory for user searches
  204.   CreateDirectory "localsearches"
  205.  
  206.   ; old source files used to live here
  207.   Delete $INSTDIR\license.txt
  208.   Delete $INSTDIR\search.ico
  209.   Delete $INSTDIR\search.nsi
  210.   Delete $INSTDIR\dqsd.xml
  211.   Delete $INSTDIR\search.xml
  212.  
  213.   ; old versions of searches to delete; most renamed or consolidated
  214.   Delete $INSTDIR\searches\aim.xml
  215.   Delete $INSTDIR\searches\ask.xml
  216.   Delete $INSTDIR\searches\at.xml
  217.   Delete $INSTDIR\searches\base.xml
  218.   Delete $INSTDIR\searches\bible.xml
  219.   Delete $INSTDIR\searches\cf.xml
  220.   Delete $INSTDIR\searches\chart.xml
  221.   Delete $INSTDIR\searches\day.xml
  222.   Delete $INSTDIR\searches\drink.xml
  223.   Delete $INSTDIR\searches\fc.xml
  224.   Delete $INSTDIR\searches\foldoc.xml
  225.   Delete $INSTDIR\searches\gga.xml
  226.   Delete $INSTDIR\searches\ggi.xml
  227.   Delete $INSTDIR\searches\ggc.xml
  228.   Delete $INSTDIR\searches\ggn.xml
  229.   Delete $INSTDIR\searches\gguk.xml
  230.   Delete $INSTDIR\searches\gwd.xml
  231.   Delete $INSTDIR\searches\ifl.xml
  232.   Delete $INSTDIR\searches\law.xml
  233.   Delete $INSTDIR\searches\lottery.xml
  234.   Delete $INSTDIR\searches\man.xml
  235.   Delete $INSTDIR\searches\map.xml
  236.   Delete $INSTDIR\searches\palm.xml
  237.   Delete $INSTDIR\searches\phone.xml
  238.   Delete $INSTDIR\searches\roman.xml
  239.   Delete $INSTDIR\searches\sbb.xml
  240.   Delete $INSTDIR\searches\sbc.xml
  241.   Delete $INSTDIR\searches\sbp.xml
  242.   Delete $INSTDIR\searches\short.xml
  243.   Delete $INSTDIR\searches\slash.xml
  244.   Delete $INSTDIR\searches\start.xml
  245.   Delete $INSTDIR\searches\tel.xml
  246.   Delete $INSTDIR\searches\tvgc.xml
  247.  
  248.   ; Write the installation path into the registry
  249.   WriteRegStr HKCR "CLSID\${DQSD_CLSID}" "InstallDir" "$INSTDIR"
  250.  
  251.   ; ??? Keep this for a while for backward compatibility
  252.   WriteRegStr HKCR "CLSID\${DQSD_CLSID}" "SecureFile" "$INSTDIR\search.htm"
  253.   WriteRegDWORD HKCR "CLSID\${DQSD_CLSID}\SecureFiles" "$INSTDIR\search.htm" 0
  254.   WriteRegDWORD HKCR "CLSID\${DQSD_CLSID}\SecureFiles" "$INSTDIR\settings.htm" 0
  255.  
  256.   ; Registry settings needed to function
  257.   WriteRegStr HKCR "CLSID\${DQSD_CLSID}" "" "Quick Search"
  258.   WriteRegStr HKCR "CLSID\${DQSD_CLSID}" "MenuText" "Add Quick Search..."
  259.   WriteRegStr HKCR "CLSID\${DQSD_CLSID}" "HelpText" "${DQSD_TITLE}"
  260.   WriteRegStr HKCR "CLSID\${DQSD_CLSID}\Implemented Categories\{00021492-0000-0000-C000-000000000046}" "" ""
  261.   WriteRegStr HKCR "CLSID\${DQSD_CLSID}\InprocServer32" "" "$SYSDIR\shdocvw.dll"
  262.   WriteRegStr HKCR "CLSID\${DQSD_CLSID}\InprocServer32" "ThreadingModel" "Apartment"
  263.   WriteRegStr HKCR "CLSID\${DQSD_CLSID}\Instance" "CLSID" "{7BA4C742-9E81-11CF-99D3-00AA004AE837}"
  264.   WriteRegStr HKCR "CLSID\${DQSD_CLSID}\Instance\InitPropertyBag" "Url" "$INSTDIR\search.htm"
  265.  
  266.   ; Add dqsd clsid to approved shell extensions - irrelevant on non-NT based OS - but doesn't hurt anything per
  267.   ; http://msdn.microsoft.com/library/en-us/shellcc/platform/Shell/programmersguide/shell_int/shell_int_extending/extensionhandlers/shell_ext.asp
  268.   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved" "${DQSD_CLSID}" "${DQSD_TITLE}"
  269.  
  270.   ; Uninstallation keys
  271.   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${DQSD_CLSID}" "DisplayName" "${DQSD_TITLE} (remove only)"
  272.   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${DQSD_CLSID}" "UninstallString" '"$INSTDIR\uninstall.exe"'
  273.  
  274.   ; Message box
  275.   IfRebootFlag rebootmsg norebootmsg
  276.     rebootmsg:
  277.       MessageBox MB_YESNO|MB_ICONINFORMATION|MB_DEFBUTTON1 "The Deskbar has been upgraded.$\nYou must reboot before it will work correctly.$\nAfter rebooting, if the search bar$\nis not visible, ${HOW_TO_TURN_ON_TOOLBAR}$\n$\nWould you like to reboot now (recommended)?" IDYES doreboot
  278.       ; MessageBox MB_OK|MB_ICONINFORMATION "Please remember to reboot before using the search bar.$\n$\n${TITLE_AND_COPYRIGHT}"
  279.       Goto endinstall
  280.     
  281.     norebootmsg:
  282.       MessageBox MB_OK|MB_ICONINFORMATION "$8"
  283.       Goto endinstall
  284.  
  285.     doreboot:
  286.       Reboot
  287.  
  288.    endinstall:
  289. SectionEnd
  290.  
  291. ; uninstall stuff
  292.  
  293. UninstallText "Click next to uninstall ${DQSD_TITLE}."
  294.  
  295. ; special uninstall section.
  296. Section "Uninstall"
  297.  
  298.   ; Unregister DQSDTools
  299.   UnRegDLL $INSTDIR\DQSDTools.dll
  300.  
  301.   ; remove approved shell extension regkey
  302.   DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved" "${DQSD_CLSID}"
  303.  
  304.   ; remove registry keys
  305.   DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${DQSD_CLSID}"
  306.   DeleteRegKey HKCR "CLSID\${DQSD_CLSID}"
  307.  
  308.   ; remove files
  309.   Delete /REBOOTOK $INSTDIR\DQSDTools.dll
  310.   Delete /REBOOTOK $INSTDIR\ChangeLog.txt
  311.   Delete /REBOOTOK $INSTDIR\aliases.txt
  312.   Delete /REBOOTOK $INSTDIR\calculate.js
  313.   Delete /REBOOTOK $INSTDIR\calendar.js
  314.   Delete /REBOOTOK $INSTDIR\categoryExpander.htc
  315.   Delete /REBOOTOK $INSTDIR\clock.js
  316.   Delete /REBOOTOK $INSTDIR\defer_tools.js
  317.   Delete /REBOOTOK $INSTDIR\helpbox.js
  318.   Delete /REBOOTOK $INSTDIR\helpmenu.js
  319.   Delete /REBOOTOK $INSTDIR\history.js
  320.   Delete /REBOOTOK $INSTDIR\holidays.ausnsw.xml
  321.   Delete /REBOOTOK $INSTDIR\holidays.fr.xml
  322.   Delete /REBOOTOK $INSTDIR\holidays.ca.xml
  323.   Delete /REBOOTOK $INSTDIR\holidays.it.xml
  324.   Delete /REBOOTOK $INSTDIR\holidays.nl.NL.xml
  325.   Delete /REBOOTOK $INSTDIR\holidays.nl.EN.xml
  326.   Delete /REBOOTOK $INSTDIR\holidays.sg.xml
  327.   Delete /REBOOTOK $INSTDIR\holidays.us.xml
  328.   Delete /REBOOTOK $INSTDIR\loader.js
  329.   Delete /REBOOTOK $INSTDIR\maximized.htm
  330.   Delete /REBOOTOK $INSTDIR\menu.txt
  331.   Delete /REBOOTOK $INSTDIR\readme.txt
  332.   Delete /REBOOTOK $INSTDIR\search.css
  333.   Delete /REBOOTOK $INSTDIR\search.htm
  334.   Delete /REBOOTOK $INSTDIR\search.xml
  335.   Delete /REBOOTOK $INSTDIR\strings.js
  336.   Delete /REBOOTOK $INSTDIR\tools.js
  337.   Delete /REBOOTOK $INSTDIR\translate.js
  338.   Delete /REBOOTOK $INSTDIR\version.js
  339.   Delete /REBOOTOK $INSTDIR\version.xml
  340.   Delete /REBOOTOK $INSTDIR\versiondialog.htm
  341.   Delete /REBOOTOK $INSTDIR\xplocalsearch.css
  342.   Delete /REBOOTOK $INSTDIR\xptoolbarbot.bmp
  343.   Delete /REBOOTOK $INSTDIR\xptoolbartop.bmp
  344.   RmDir /r $INSTDIR\src
  345.   RmDir /r $INSTDIR\searches
  346.   RmDir /r $INSTDIR\addons
  347.  
  348.   ; Remove preferences too
  349.   Delete /REBOOTOK $INSTDIR\preferences.js
  350.  
  351.   ; MUST REMOVE UNINSTALLER, too
  352.   Delete /REBOOTOK $INSTDIR\uninstall.exe
  353.  
  354.   ; Delete directory
  355.   RmDir /r $INSTDIR
  356.  
  357. SectionEnd
  358.  
  359. ; eof