home *** CD-ROM | disk | FTP | other *** search
/ Computer Music Interactif 10 / cd.iso / pc / PC / SHARES / looprecorder / SwSetup.Inf < prev   
Encoding:
Text File  |  2000-01-27  |  9.0 KB  |  333 lines

  1. /*
  2. _____________________________________________________________________
  3.  
  4. Loop Recorder
  5. _____________________________________________________________________
  6.  
  7. © 2000 Thomas Riechmann, Gerald Riechmann
  8. _____________________________________________________________________
  9.  
  10. */
  11.  
  12. myProg = 'Loop Recorder'
  13. myExe = 'LoopRec.exe'
  14. myShort = 'LoopRec'
  15. myTitle = myProg
  16.  
  17. myVersion = getVersion myExe
  18. if __error__ != 0 // ok
  19.     myTitle = '%myProg% %myVersion%'
  20. endif
  21.  
  22. myProgRegistry = 'Software\\LoopRec-Application\\LOOPREC'
  23.  
  24. DialogLoggingOff myTitle
  25. // CreateBackground myTitle
  26.  
  27. myInstallDir = pwd    // Installation from the actual directory
  28. programFilesDir = GetRegistry    'HKEY_LOCAL_MACHINE' 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion' 'ProgramFilesDir'
  29.  
  30. myProgGroup =    GetRegistry    'HKEY_CURRENT_USER' myProgRegistry 'Group'
  31. if __error__ == 0 // Error!
  32.     myProgGroup = myProg
  33. endif
  34.  
  35. myProgramDir =    GetRegistry    'HKEY_CURRENT_USER' myProgRegistry 'Folder'
  36. if __error__ == 0 // Error!
  37.     myProgramDir = '%programFilesDir%\\%myProg%'
  38. endif
  39.  
  40. myUnInf = '%__WindowsVerzeichnis__%\\%myShort%Uninstall.inf'
  41.  
  42. addDesktopIcon = 1;
  43. addStartUpIcon = 0;
  44.  
  45. showLicense = 1;
  46. agreeLicense = 0;
  47.  
  48. If __Language__ == 'deu'
  49.     myLicense = 'Lizenz.txt'
  50. Else
  51.     myLicense = 'License.txt'
  52. EndIf       
  53.  
  54.  
  55. filesToCopy[0] = myExe
  56. filesToCopy[1] = '%myShort%.chm'
  57. filesToCopy[2] = myLicense
  58. filesToCopy[3] = 'ReadMe.txt'
  59. filesToCopy[4] = '' // letztes mufl leer sein!
  60.  
  61.  
  62. argvTest = TranslateString __SwSetupFileName__ 'ninstall' 'test'
  63. if argvTest != __SwSetupFileName__
  64.     goto :uninstall
  65. endif
  66.  
  67. i = 0
  68. while filesToCopy[i]
  69.     thisFile = filesToCopy[i]
  70.     DialogLoggingOff 'Testing: %thisFile% ...'
  71.     TestFile thisFile
  72.     if __error__ == 0 // Error!
  73.         MessageBox 'Error: File %thisFile% not found.'
  74.         Exit
  75.     endif
  76.  
  77.     i++
  78. endwhile
  79.  
  80.  
  81. WizardCreate
  82. __WizardTitle__ = myTitle
  83. __WizardBitmap__ = 'LoopRec.bmp'
  84.  
  85.  
  86.  
  87.  
  88. :pagea
  89.     cd myInstallDir
  90.     rc = WizardPageBrowse (__WizardNext__) NO 'Welcome to %myProg% Setup.\n\nPlease read the software license agreement carefully before using the software.' NO CHECK showLicense 'I want to read the license agreement.'
  91.  
  92.     if rc == __WizardCancel__
  93.         exit
  94.     EndIf
  95.  
  96. if showLicense
  97.     showLicense = 0
  98.     Exec 'notepad.exe %myLicense%' 1
  99. endif
  100.  
  101. :pageb
  102.     rc = WizardPageBrowse (__WizardBack__ + __WizardNext__) NO '%myProg% license agreement.' NO CHECK agreeLicense 'Accept license agreement. (required)'
  103.  
  104.     if rc == __WizardBack__
  105.         Goto :pagea
  106.     EndIf
  107.     if rc == __WizardCancel__
  108.         exit
  109.     EndIf
  110.  
  111. if ! agreeLicense
  112.     MessageBox 'Sorry, you must accept the license agreement, if you want to install and use %myProg%!' (48+5)
  113.     if __error__ == 4
  114.         goto :pageb
  115.     endif
  116.     exit
  117. EndIf
  118.  
  119. :page1
  120.     cd programFilesDir
  121.     rc = WizardPageBrowse (__WizardBack__ + __WizardNext__) DIR 'Please select the Group to install %myProg% to.' myProgramDir
  122.  
  123.     if rc == __WizardBack__
  124.         Goto :pageb
  125.     EndIf
  126.     if rc == __WizardCancel__
  127.         exit
  128.     EndIf
  129.  
  130.  
  131. :page2
  132.  
  133.     rc = WizardPageBrowse (__WizardBack__ + __WizardNext__) GROUP 'Select a Group to add the icons to.' myProgGroup CHECK addDesktopIcon 'Add Icon to the Desktop' addStartUpIcon 'Add %myProg% to the StartUp group.'
  134.  
  135.     if rc == __WizardBack__
  136.         Goto :page1
  137.     EndIf
  138.     if rc == __WizardCancel__
  139.         exit
  140.     EndIf
  141.  
  142. :page3
  143.  
  144.     rc = WizardPageText     (__WizardBack__ + __WizardFinish__)    'Ready to install %myTitle% to %myProgramDir%!\n\nSetup Directory: %myInstallDir%\nProgram Group: %myProgGroup%'
  145.  
  146.     if rc == __WizardBack__
  147.         Goto :page2
  148.     EndIf
  149.     if rc == __WizardCancel__
  150.         exit
  151.     EndIf
  152.  
  153.  
  154. WizardClose
  155.  
  156.  
  157. mkdir myProgramDir
  158. cd myInstallDir
  159.  
  160.  
  161.  
  162. i = 0
  163. while filesToCopy[i]
  164.     thisFile = filesToCopy[i]
  165.     DialogLoggingOff 'Copying: %thisFile% ...'
  166.  
  167.     CopyFile thisFile '%myProgramDir%\\%thisFile%' 'Always'
  168.     if __error__ == 0 // Error!
  169.         MessageBox 'Error copying file %thisFile%.'
  170.         Exit
  171.     endif
  172.  
  173.     i++
  174. endwhile
  175.  
  176. CopyFile 'SwSetup.exe' '%__WindowsVerzeichnis__%\\SwSetupU.exe'
  177. CopyFile __SwSetupFileName__ myUnInf 'Always'
  178. if __error__ == 0 // Error!
  179.     MessageBox 'Error creating file %myUnInf%.'
  180. endif
  181.  
  182. DialogLoggingOff 'Updating Settings...'
  183.  
  184. SetRegistry 'HKEY_LOCAL_MACHINE' 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\%myExe%' '' '%myProgramDir%\\%myExe%'
  185. SetRegistry 'HKEY_LOCAL_MACHINE' 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%myProg%' 'DisplayName' '%myTitle% (remove only)'
  186. SetRegistry 'HKEY_LOCAL_MACHINE' 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%myProg%' 'UninstallString' '"%__WindowsVerzeichnis__%\\SwSetupU.exe" "%myUnInf%"'
  187.  
  188. SetRegistry 'HKEY_CURRENT_USER' myProgRegistry 'Group' myProgGroup
  189. SetRegistry 'HKEY_CURRENT_USER' myProgRegistry 'Folder' myProgramDir
  190.  
  191. // No Sound on Open & Close
  192. SetRegistry 'HKEY_CURRENT_USER' 'AppEvents\\Schemes\\Apps\\%myShort%' '' myProg
  193. SetRegistry 'HKEY_CURRENT_USER' 'AppEvents\\Schemes\\Apps\\%myShort%\\Open\\.Current' '' ''
  194. SetRegistry 'HKEY_CURRENT_USER' 'AppEvents\\Schemes\\Apps\\%myShort%\\Close\\.Current' '' ''
  195.  
  196.  
  197. // HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\FlexiCD
  198. // DisplayName
  199. // UninstallString
  200.  
  201. DialogLoggingOff 'Updating Start Menu...'
  202.  
  203.  
  204. CreateItem '\\PG\\%myProgGroup%' '%myProg%  ' '%myProgramDir%\\%myExe%' '' '%myProgramDir%'  '%myProgramDir%\\%myExe%' 0 0
  205. CreateItem '\\PG\\%myProgGroup%' '%myProg% (idle mode)' '%myProgramDir%\\%myExe%' '-x' '%myProgramDir%'  '%myProgramDir%\\%myExe%' 4 0
  206. CreateItem '\\PG\\%myProgGroup%' '%myProg% Help' '%myProgramDir%\\%myShort%.chm' '' '%myProgramDir%'  '' 0 0
  207. CreateItem '\\PG\\%myProgGroup%' '%myProg% Readme' '%__WindowsVerzeichnis__%\\notepad.exe' '%myProgramDir%\\Readme.txt' '%myProgramDir%'  '%__WindowsSystemDirectory__%\\shell32.dll' 48 0
  208.  
  209. if addDesktopIcon
  210.     CreateItem '\\DT\\' myProg '%myProgramDir%\\%myExe%' '' '%myProgramDir%'  '' 0 0
  211. endif
  212.  
  213. if addStartUpIcon 
  214.     CreateItem '\\PS\\' myProg '%myProgramDir%\\%myExe%' '' '%myProgramDir%'  '' 0 1
  215. endif
  216.  
  217. DialogLoggingOff 'Installation complete.'
  218. sleep 3
  219.  
  220. // HTML-Help-Update...
  221.  
  222. TestFile '%__WindowsVerzeichnis__%\\hh.exe'
  223. if __error__ == 0 // File does not exist
  224.     TestFile 'hhupd.exe'
  225.     if __error__ != 0 // File exists
  226.         DialogLoggingOff 'Microsoft HTML-Help not found, installing...'
  227.         sleep 1
  228.         Exec 'hhupd.exe' 1
  229.     else
  230.         MessageBox '%myTitle% Setup complete. To use the Help however, you need to install the HTML-Help update (hhupd.exe) from Microsoft. Jump to the Webpage now?' 36
  231.         if __error__ == 6
  232.             Exec 'RunDll32.exe url.dll,FileProtocolHandler http://msdn.microsoft.com/workshop/author/htmlhelp/localize.asp' 1
  233.         else
  234.             MessageBox 'You will not be able to use %myProg%''s Help until you install the HTML-Help update.' 48
  235.         endif
  236.     endif
  237. endif
  238.  
  239. // MessageBox 'Installation complete. To start %myProg%, look for new entries in your Start Menu!'
  240. goto :end
  241.  
  242. :uninstall
  243.  
  244. deleteError = 1
  245.  
  246. DialogLoggingOff 'Uninstalling %myTitle%'
  247.  
  248.  
  249. dummy = GetRegistry 'HKEY_LOCAL_MACHINE' 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%myProg%' 'UninstallString'
  250. if __error__ == 0 // Error!
  251.     MessageBox '%myTitle% was not installed correctly.'
  252.     exit
  253. endif
  254.  
  255. MessageBox 'Do you want to uninstall %myTitle%?' 33
  256. if __error__ != 1  // no!
  257.     exit
  258. endif
  259.  
  260.  
  261. i = 0
  262. while filesToCopy[i]
  263.     thisFile = filesToCopy[i]
  264.     DialogLoggingOff 'Deleting: %myProgramDir%\\%thisFile% ...'
  265.  
  266.     DeleteFile '%myProgramDir%\\%thisFile%'
  267.     if __error__ == 0 // Error!
  268.         DialogLoggingOff 'Error deleting: %myProgramDir%\\%thisFile% ...'
  269.         sleep 1
  270.         deleteError = 0
  271.     endif
  272.  
  273.     i++
  274. endwhile
  275.  
  276. rmdir myProgramDir
  277.  
  278. sleep 1
  279.  
  280. DialogLoggingOff 'Removing Icons...'
  281.  
  282. CreateItem '-\\PG\\%myProgGroup%' '%myProg%  ' '' '' '' '' 0 0
  283. deleteError *= __error__
  284. CreateItem '-\\PG\\%myProgGroup%' '%myProg% (idle mode)' '' '' '' '' 0 0
  285. deleteError *= __error__
  286. CreateItem '-\\PG\\%myProgGroup%' '%myProg% Help' '' '' '' '' 0 0
  287. deleteError *= __error__
  288. CreateItem '-\\PG\\%myProgGroup%' '%myProg% Readme' '' '' ''  '' 0 0
  289. deleteError *= __error__
  290. CreateItem '-\\PG\\%myProgGroup%' myProg '' '' '' '' 0 0
  291. CreateItem '-\\DT\\' myProg '' '' '' '' 0 0
  292. CreateItem '-\\PS\\' myProg '' '' '' '' 0 0
  293.  
  294. sleep 1
  295.  
  296.  
  297. DialogLoggingOff 'Cleaning Registry...'
  298.  
  299. DeleteRegistry 'HKEY_LOCAL_MACHINE' 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%myProg%' ''
  300. deleteError *= __error__
  301. DeleteRegistry 'HKEY_LOCAL_MACHINE' 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\%myExe%' ''
  302. deleteError *= __error__
  303.  
  304. MessageBox 'Do you wish to keep the settings and registration details?' 36
  305. if __error__ == 6 // Yes!
  306.     DeleteRegistry 'HKEY_CURRENT_USER' myProgRegistry 'Group'
  307.     DeleteRegistry 'HKEY_CURRENT_USER' myProgRegistry 'Folder'
  308. else
  309.     DeleteRegistry 'HKEY_CURRENT_USER' myProgRegistry ''
  310.     deleteError *= __error__
  311. endif
  312.  
  313.  
  314. DeleteRegistry 'HKEY_CURRENT_USER' 'AppEvents\\Schemes\\Apps\\%myShort%' ''
  315. deleteError *= __error__
  316.  
  317.  
  318. sleep 1
  319.  
  320. if ! deleteError
  321.     DialogLoggingOff 'Some items could not be removed. You should delete them yourself.'
  322. else
  323.     DialogLoggingOff 'Uninstall successfull.'
  324. endif
  325.  
  326. DeleteFile myUnInf
  327.  
  328. :end
  329.  
  330. DialogLoggingOff 'Thank you. Good bye.'
  331. sleep 2
  332. exit
  333.