Results 1 to 7 of 7

Thread: Uninstall previous before installing (SB5 Pro)

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default Uninstall previous before installing (SB5 Pro)

    How does one detect whether the app was previously installed and offer to
    uninstall first prior to new install?

    ~~~~~~~~~~~~~~~~~~~
    Sim Sherer

  2. #2

    Default Re: Uninstall previous before installing (SB5 Pro)

    Hi Sim,

    I don't think Friedrich has a specific function for this but it
    wouldn't surprise me

    What I normally do is on the initial installation I get SB5 to write a
    registry entry that notes the installation directory. All subsequent
    installations/updates can read this registry value. This serves to
    firstly confirm that the application has been previously installed and
    secondly where to.

    I don't offer to uninstall but if I were, I could easily use the
    registry entry to tell me where the application resides and therefore
    where the uninstaller resides. I then just have to RUN it. I don't
    know whether you can include a RUN Parameter to make the uninstall
    silent, but if not it would be easy to do something like this:
    Get your installer to write an entry to an ini file before RUNning the
    uninstaller. You would have designed your uninstaller such that it
    would be set up to read the value of that ini file to determine if it
    was to be a silent uninstall or a normal uninstall.

    There's probably a number of ways to do this given the power of SB5
    but the above would work just fine.

    Best Regards,
    Geoff Spillane
    Data Down Under

  3. #3

    Default Re: Uninstall previous before installing (SB5 Pro)

    >How does one detect whether the app was previously installed and offer to
    >uninstall first prior to new install?

    Sim,

    What Geoff said. SB's Run Program does have a Wait for Program option. Here's
    some other things that come to mind.

    Developer Edition has a Detect Previous Version script item that sets a
    variable to the path to the previous version, if detected. With that you can
    execute your uninstall like so: PathToYourUninstall.exe /U
    "PathToYourUninstall.log". Be sure to quote the install log path if it
    contains spaces.

    Search for File in the Developer Edition is an alternative to Detect Previous
    Version. You could use it to search for your exe and/or your uninstall
    program, executing the uninstall after verifying the log file exists.

    If you have to be sure the uninstall completed successfully, SB's Run Program
    sets % SB ERRORCODE% to zero on success. I don't know if that's an indication
    of successful execution by the OS, or an exit value from the run process. It
    would be easy enough to verify the program no longer exists, if needed.

    Using either of those methods to detect the program's existence, you could
    simply display a message asking the user to uninstall the previous release,
    and then exit the script.

    --
    Best regards,

    Mark

    -------------------------------------------------------------------
    Why waste time learning when ignorance is instantaneous?
    We do email right!
    Rock solid hosting services at http://www.lanbytes.net

  4. #4

    Default Re: Uninstall previous before installing (SB5 Pro)

    Hi Mark,

    I had found that on occasions the wait flag for the RUN function
    didn't do the trick, particularly when the EXE launched is a
    windowless process, so Friedrich showed me a clever way of using the
    power of the scripting language to make sure a process had indeed
    finished. In the code below I launch the Windows media player
    installer in silent mode then set up a loop to periodically look to
    see if the installation has completed. If it gets to Loop 4 then it
    breaks the loop with a message saying the uninstall failed. The full
    list of Return codes for the RUN function follows.

    Run Program %_SB_INSTALLDIR%\wmpcdcs8.exe (Always Install)
    Set Variable %LOOPID% to 1
    Loop
    Set Variable %LOOPID% to (Increment variable by 1)
    Pause for "3" seconds
    Set Variable %ACTIVE% to Detect Active Application(wmpcdcs8.exe)
    If %ACTIVE% Equals "0" Or %ACTIVE% Equals "603" Then
    Break Loop
    End
    If %LOOPID% Equals "4" Then
    Message Box "The uninstall failed.........."
    Break Loop
    End
    End

    // Return codes are as follows:
    // 0 = Process was successfully terminated (Process was not found)
    // 1 = Process was found
    // 603 = Process was not currently running
    // 604 = No permission to terminate process
    // 605 = Unable to load PSAPI.DLL
    // 602 = Unable to terminate process for some other reason
    // 606 = Unable to identify system type
    // 607 = Unsupported OS
    // 632 = Invalid process name
    // 700 = Unable to get procedure address from PSAPI.DLL
    // 701 = Unable to get process list, EnumProcesses failed
    // 702 = Unable to load KERNEL32.DLL
    // 703 = Unable to get procedure address from KERNEL32.DLL
    // 704 = CreateToolhelp32Snapshot failed

    Best Regards,
    Geoff Spillane

  5. #5

    Default Re: Uninstall previous before installing (SB5 Pro)

    Very interesting, Geoff. Thanks. Where did the run return codes come from?

    --
    Best regards,

    Mark

    -------------------------------------------------------------------
    Why waste time learning when ignorance is instantaneous?
    We do email right!
    Rock solid hosting services at http://www.lanbytes.net

  6. #6

    Default Re: Uninstall previous before installing (SB5 Pro)

    Hi Mark,

    To be quite honest I don't know. When Friedrich first gave me some
    example code it didn't give the correct results so I monitored the
    return value and told Friedrich my observations and he came back with
    confirmation of what I had found plus what the errorcode meant
    together with the list of all the other possible values. I had
    presumed that they were the return values from the API he used (which
    I thought I knew) but I can't find them in the SDK.

    Best Regards,
    Geoff Spillane
    Data Down Under

  7. #7

    Default Re: Uninstall previous before installing (SB5 Pro)

    Mark,

    Open the "Detect Active Application" script item dialog and press F1 to
    display the help ;-)

    Friedrich

    --
    Friedrich Linder
    CEO, Lindersoft
    www.lindersoft.com
    1.954.252.3910

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How can I get Setup builder to uninstall a previous version
    By NewsArchive in forum SetupBuilder - NNTP
    Replies: 3
    Last Post: 11-09-2006, 05:46 AM
  2. Updater mangles uninstall log
    By Stephenns in forum SetupBuilder
    Replies: 1
    Last Post: 09-28-2006, 11:34 PM
  3. #00012: How to detect and uninstall previous version?
    By FAQ in forum SetupBuilder FAQs, Tips and Techniques
    Replies: 0
    Last Post: 02-13-2006, 08:57 AM
  4. Uninstall
    By NewsArchive in forum SetupBuilder - NNTP
    Replies: 5
    Last Post: 04-15-2005, 09:53 AM
  5. Uninstall name
    By NewsArchive in forum SetupBuilder - NNTP
    Replies: 6
    Last Post: 02-24-2005, 10:06 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •