Post a reply to the thread: Detect Previous Version Installed
Click here to log in
What's the name of our main installation product (in uppercase letters), directly followed by the current year?
You may choose an icon for your message from this list
Will turn www.example.com into [URL]http://www.example.com[/URL].
Re: Detect Previous Version Installed Yes, this is a very good starting point! Friedrich
Re: Detect Previous Version Installed
Re: Detect Previous Version Installed I have posted a demo here: http://www.lindersoft.com/forums/sho...0468#post60468 Friedrich
Re: Detect Previous Version Installed >> (e.g. search all available hard-drives for a specific file name) and then I can tell you how to convert it to SetupScript. That is exactly what I need to do :-) So please explain how.
Re: Detect Previous Version Installed Will this work: Code: [ Initialize Setup ] ! --- Define commonly used constants --- #include script "Common Definitions.sbi" ! Important: Initialize default install folder and program group variables Set Variable %COMPANY% to "MyCompany" Set Variable %APPTITLE% to "MyProduct" ! BEGIN: Detect Previous Version -------------------- Set Variable %PREVIOUS_VERSION_DETECTED% to "$FALSE$" Set Variable %PREVIOUS_VERSION_NUMBER% to "1.0.4.0" Set Variable %PREVIOUS_PATH% to "" ! Detect an older version of MyProduct Set Variable %APPTITLE% to FUNCTION:Search For File("MyProduct.exe", 4) in "MyProduct.exe" [Return List] If %_SB_ERRORCODE% Does Not Equal (Ignore Case) "0" Then Set Variable %PREVIOUS_VERSION_DETECTED% to "$TRUE$" Set Variable %_SB_INSTALLDIR% to "%PREVIOUS_PATH%" Set Variable %PREVIOUS_VERSION_NUMBER% to "%_SB_RETURNEX%" Display Message Box "This installer has successfully detected a previou..." -- "Previous Version Detected" Run Program %PREVIOUS_PATH%\MyProduct.exe %PREVIOUS_PATH%\Uninst_MyProduct.exe (Always Install) [Wait] ! Will this delete all the files with the extension Delete Files "%PREVIOUS_PATH%\Backup\*.txt" Delete Folder "%PREVIOUS_PATH%\Backup" End If there is no older version detected or when the older version is detected and un-installed then I want to start the installation of the new version at the end of this script.
[ Initialize Setup ] ! --- Define commonly used constants --- #include script "Common Definitions.sbi" ! Important: Initialize default install folder and program group variables Set Variable %COMPANY% to "MyCompany" Set Variable %APPTITLE% to "MyProduct" ! BEGIN: Detect Previous Version -------------------- Set Variable %PREVIOUS_VERSION_DETECTED% to "$FALSE$" Set Variable %PREVIOUS_VERSION_NUMBER% to "1.0.4.0" Set Variable %PREVIOUS_PATH% to "" ! Detect an older version of MyProduct Set Variable %APPTITLE% to FUNCTION:Search For File("MyProduct.exe", 4) in "MyProduct.exe" [Return List] If %_SB_ERRORCODE% Does Not Equal (Ignore Case) "0" Then Set Variable %PREVIOUS_VERSION_DETECTED% to "$TRUE$" Set Variable %_SB_INSTALLDIR% to "%PREVIOUS_PATH%" Set Variable %PREVIOUS_VERSION_NUMBER% to "%_SB_RETURNEX%" Display Message Box "This installer has successfully detected a previou..." -- "Previous Version Detected" Run Program %PREVIOUS_PATH%\MyProduct.exe %PREVIOUS_PATH%\Uninst_MyProduct.exe (Always Install) [Wait] ! Will this delete all the files with the extension Delete Files "%PREVIOUS_PATH%\Backup\*.txt" Delete Folder "%PREVIOUS_PATH%\Backup" End
Re: Detect Previous Version Installed I think at this point, it would be easier to search for the .exe name on the users computer. If found then I could run a un-install. In addition I could then delete all the folders/files associated with the older version. I tried to copy "Detect Previous Application B" into my setup, but I was unable to do so. I wanted to use this script and call it before the install runs on the new version. I know you can include scripts I just can't figure out how to include them. thanks,
Re: Detect Previous Version Installed BTW, to remove files and folders created AFTER the installation, you have to compile a "custom uninstall" (see "Creating a Custom Uninstall" in the manual). Of course, you can also handle this directly from your installer, e.g. using the "Delete File(s)...", "Delete Foilder Tree...", etc. script functions. Friedrich
Re: Detect Previous Version Installed Robert, If you do not have the Product GUID but you have registered your uninstall application with Windows, what you can do is to enumerate the all keys in the Windows Uninstall registry key (e.g. using the "Get Registry SubKey..." script function) to try to detect your previous version. The uninstall key is located at: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Curr entVersion\Uninstall The (displayed) name of the product can be found in the "DisplayName" value. If detected, read the uninstall .exe location from the registry (e.g. using the "Get Registry Key Value..." script function) and execute the uninstall application (e.g. using the "Run Command Line..." script function). The uninstall commands are stored in the "UninstallString" value. Does this help? If you can't use the above "method", let me know how you would do it without SetupBuilder (e.g. search all available hard-drives for a specific file name) and then I can tell you how to convert it to SetupScript. Friedrich
Detect Previous Version Installed Hello, If you have already compiled a newer version of your softwae, and you do not have the older GUID code how would you detect an older version and uninstall the program including any files/folders created since the install? Thanks,
Detect Previous Version Installed
Forum Rules