home *** CD-ROM | disk | FTP | other *** search
Wrap
/* _____________________________________________________________________ Loop Recorder _____________________________________________________________________ © 2000 Thomas Riechmann, Gerald Riechmann _____________________________________________________________________ */ myProg = 'Loop Recorder' myExe = 'LoopRec.exe' myShort = 'LoopRec' myTitle = myProg myVersion = getVersion myExe if __error__ != 0 // ok myTitle = '%myProg% %myVersion%' endif myProgRegistry = 'Software\\LoopRec-Application\\LOOPREC' DialogLoggingOff myTitle // CreateBackground myTitle myInstallDir = pwd // Installation from the actual directory programFilesDir = GetRegistry 'HKEY_LOCAL_MACHINE' 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion' 'ProgramFilesDir' myProgGroup = GetRegistry 'HKEY_CURRENT_USER' myProgRegistry 'Group' if __error__ == 0 // Error! myProgGroup = myProg endif myProgramDir = GetRegistry 'HKEY_CURRENT_USER' myProgRegistry 'Folder' if __error__ == 0 // Error! myProgramDir = '%programFilesDir%\\%myProg%' endif myUnInf = '%__WindowsVerzeichnis__%\\%myShort%Uninstall.inf' addDesktopIcon = 1; addStartUpIcon = 0; showLicense = 1; agreeLicense = 0; If __Language__ == 'deu' myLicense = 'Lizenz.txt' Else myLicense = 'License.txt' EndIf filesToCopy[0] = myExe filesToCopy[1] = '%myShort%.chm' filesToCopy[2] = myLicense filesToCopy[3] = 'ReadMe.txt' filesToCopy[4] = '' // letztes mufl leer sein! argvTest = TranslateString __SwSetupFileName__ 'ninstall' 'test' if argvTest != __SwSetupFileName__ goto :uninstall endif i = 0 while filesToCopy[i] thisFile = filesToCopy[i] DialogLoggingOff 'Testing: %thisFile% ...' TestFile thisFile if __error__ == 0 // Error! MessageBox 'Error: File %thisFile% not found.' Exit endif i++ endwhile WizardCreate __WizardTitle__ = myTitle __WizardBitmap__ = 'LoopRec.bmp' :pagea cd myInstallDir 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.' if rc == __WizardCancel__ exit EndIf if showLicense showLicense = 0 Exec 'notepad.exe %myLicense%' 1 endif :pageb rc = WizardPageBrowse (__WizardBack__ + __WizardNext__) NO '%myProg% license agreement.' NO CHECK agreeLicense 'Accept license agreement. (required)' if rc == __WizardBack__ Goto :pagea EndIf if rc == __WizardCancel__ exit EndIf if ! agreeLicense MessageBox 'Sorry, you must accept the license agreement, if you want to install and use %myProg%!' (48+5) if __error__ == 4 goto :pageb endif exit EndIf :page1 cd programFilesDir rc = WizardPageBrowse (__WizardBack__ + __WizardNext__) DIR 'Please select the Group to install %myProg% to.' myProgramDir if rc == __WizardBack__ Goto :pageb EndIf if rc == __WizardCancel__ exit EndIf :page2 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.' if rc == __WizardBack__ Goto :page1 EndIf if rc == __WizardCancel__ exit EndIf :page3 rc = WizardPageText (__WizardBack__ + __WizardFinish__) 'Ready to install %myTitle% to %myProgramDir%!\n\nSetup Directory: %myInstallDir%\nProgram Group: %myProgGroup%' if rc == __WizardBack__ Goto :page2 EndIf if rc == __WizardCancel__ exit EndIf WizardClose mkdir myProgramDir cd myInstallDir i = 0 while filesToCopy[i] thisFile = filesToCopy[i] DialogLoggingOff 'Copying: %thisFile% ...' CopyFile thisFile '%myProgramDir%\\%thisFile%' 'Always' if __error__ == 0 // Error! MessageBox 'Error copying file %thisFile%.' Exit endif i++ endwhile CopyFile 'SwSetup.exe' '%__WindowsVerzeichnis__%\\SwSetupU.exe' CopyFile __SwSetupFileName__ myUnInf 'Always' if __error__ == 0 // Error! MessageBox 'Error creating file %myUnInf%.' endif DialogLoggingOff 'Updating Settings...' SetRegistry 'HKEY_LOCAL_MACHINE' 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\%myExe%' '' '%myProgramDir%\\%myExe%' SetRegistry 'HKEY_LOCAL_MACHINE' 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%myProg%' 'DisplayName' '%myTitle% (remove only)' SetRegistry 'HKEY_LOCAL_MACHINE' 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%myProg%' 'UninstallString' '"%__WindowsVerzeichnis__%\\SwSetupU.exe" "%myUnInf%"' SetRegistry 'HKEY_CURRENT_USER' myProgRegistry 'Group' myProgGroup SetRegistry 'HKEY_CURRENT_USER' myProgRegistry 'Folder' myProgramDir // No Sound on Open & Close SetRegistry 'HKEY_CURRENT_USER' 'AppEvents\\Schemes\\Apps\\%myShort%' '' myProg SetRegistry 'HKEY_CURRENT_USER' 'AppEvents\\Schemes\\Apps\\%myShort%\\Open\\.Current' '' '' SetRegistry 'HKEY_CURRENT_USER' 'AppEvents\\Schemes\\Apps\\%myShort%\\Close\\.Current' '' '' // HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\FlexiCD // DisplayName // UninstallString DialogLoggingOff 'Updating Start Menu...' CreateItem '\\PG\\%myProgGroup%' '%myProg% ' '%myProgramDir%\\%myExe%' '' '%myProgramDir%' '%myProgramDir%\\%myExe%' 0 0 CreateItem '\\PG\\%myProgGroup%' '%myProg% (idle mode)' '%myProgramDir%\\%myExe%' '-x' '%myProgramDir%' '%myProgramDir%\\%myExe%' 4 0 CreateItem '\\PG\\%myProgGroup%' '%myProg% Help' '%myProgramDir%\\%myShort%.chm' '' '%myProgramDir%' '' 0 0 CreateItem '\\PG\\%myProgGroup%' '%myProg% Readme' '%__WindowsVerzeichnis__%\\notepad.exe' '%myProgramDir%\\Readme.txt' '%myProgramDir%' '%__WindowsSystemDirectory__%\\shell32.dll' 48 0 if addDesktopIcon CreateItem '\\DT\\' myProg '%myProgramDir%\\%myExe%' '' '%myProgramDir%' '' 0 0 endif if addStartUpIcon CreateItem '\\PS\\' myProg '%myProgramDir%\\%myExe%' '' '%myProgramDir%' '' 0 1 endif DialogLoggingOff 'Installation complete.' sleep 3 // HTML-Help-Update... TestFile '%__WindowsVerzeichnis__%\\hh.exe' if __error__ == 0 // File does not exist TestFile 'hhupd.exe' if __error__ != 0 // File exists DialogLoggingOff 'Microsoft HTML-Help not found, installing...' sleep 1 Exec 'hhupd.exe' 1 else 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 if __error__ == 6 Exec 'RunDll32.exe url.dll,FileProtocolHandler http://msdn.microsoft.com/workshop/author/htmlhelp/localize.asp' 1 else MessageBox 'You will not be able to use %myProg%''s Help until you install the HTML-Help update.' 48 endif endif endif // MessageBox 'Installation complete. To start %myProg%, look for new entries in your Start Menu!' goto :end :uninstall deleteError = 1 DialogLoggingOff 'Uninstalling %myTitle%' dummy = GetRegistry 'HKEY_LOCAL_MACHINE' 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%myProg%' 'UninstallString' if __error__ == 0 // Error! MessageBox '%myTitle% was not installed correctly.' exit endif MessageBox 'Do you want to uninstall %myTitle%?' 33 if __error__ != 1 // no! exit endif i = 0 while filesToCopy[i] thisFile = filesToCopy[i] DialogLoggingOff 'Deleting: %myProgramDir%\\%thisFile% ...' DeleteFile '%myProgramDir%\\%thisFile%' if __error__ == 0 // Error! DialogLoggingOff 'Error deleting: %myProgramDir%\\%thisFile% ...' sleep 1 deleteError = 0 endif i++ endwhile rmdir myProgramDir sleep 1 DialogLoggingOff 'Removing Icons...' CreateItem '-\\PG\\%myProgGroup%' '%myProg% ' '' '' '' '' 0 0 deleteError *= __error__ CreateItem '-\\PG\\%myProgGroup%' '%myProg% (idle mode)' '' '' '' '' 0 0 deleteError *= __error__ CreateItem '-\\PG\\%myProgGroup%' '%myProg% Help' '' '' '' '' 0 0 deleteError *= __error__ CreateItem '-\\PG\\%myProgGroup%' '%myProg% Readme' '' '' '' '' 0 0 deleteError *= __error__ CreateItem '-\\PG\\%myProgGroup%' myProg '' '' '' '' 0 0 CreateItem '-\\DT\\' myProg '' '' '' '' 0 0 CreateItem '-\\PS\\' myProg '' '' '' '' 0 0 sleep 1 DialogLoggingOff 'Cleaning Registry...' DeleteRegistry 'HKEY_LOCAL_MACHINE' 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%myProg%' '' deleteError *= __error__ DeleteRegistry 'HKEY_LOCAL_MACHINE' 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\%myExe%' '' deleteError *= __error__ MessageBox 'Do you wish to keep the settings and registration details?' 36 if __error__ == 6 // Yes! DeleteRegistry 'HKEY_CURRENT_USER' myProgRegistry 'Group' DeleteRegistry 'HKEY_CURRENT_USER' myProgRegistry 'Folder' else DeleteRegistry 'HKEY_CURRENT_USER' myProgRegistry '' deleteError *= __error__ endif DeleteRegistry 'HKEY_CURRENT_USER' 'AppEvents\\Schemes\\Apps\\%myShort%' '' deleteError *= __error__ sleep 1 if ! deleteError DialogLoggingOff 'Some items could not be removed. You should delete them yourself.' else DialogLoggingOff 'Uninstall successfull.' endif DeleteFile myUnInf :end DialogLoggingOff 'Thank you. Good bye.' sleep 2 exit