Jump to content

Installing a 3rd party app - clean install vs. upgrade shows different forms


Recommended Posts

Hi folks.

I am trying to use AutoIt to install a 3rd party application, namely WinPcap. I wrote a script to do this, and for a clean install, the script works flawlessly. The problem is that if an older version of WinPcap is installed, the upgrade screens are very different (it first wants to go through an uninstall process) and my script no longer fits. Also the possibility exists that the current version is already installed; this results in yet a 3rd set of screens displayed.

I thought of using WinWaitActive("WinPcap") (since all the headers start like this) and a switch statement with a bunch of "If WinActive (xxx)" to handle all the possible combinations. Is that the way to go, or is there a more clever solution to create a multi-branching script to handle the three possible situations?

Run("WinPcap_4_1_2.exe")
WinWaitActive("WinPcap 4.1.2 Setup", "WinPcap 4.1.2 Installer")
Send("!n")
WinWaitActive("WinPcap 4.1.2 Setup", "Welcome")
Send("!n")
WinWaitActive("WinPcap 4.1.2 Setup", "License Agreement")
Send("!a")
WinWaitActive("WinPcap 4.1.2 Setup", "Installation options")
Send("!i")
WinWaitActive("WinPcap 4.1.2 Setup", "Completing")
Send("!f")

Thanks,

Dave

Link to comment
Share on other sites

One method:

$iTimer = TimerInit()
While 1
    Select
        Case WinExists("Possible Window Title One", "Window Text One")
            ; Code here to handle first possibility
            ExitLoop
            
        Case WinExists("Possible Window Title Two", "Window Text Two")
            ; Code here to handle second possibility
            ExitLoop
            
        Case WinExists("Possible Window Title Three", "Window Text Three")
            ; Code here to handle third possibility
            ExitLoop
            
        Case TimerDiff($iTimer) >= 5000 Then
            MsgBox(16, "Error", "Timeout occured!")
            Exit
    EndSelect
WEnd

:unsure:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Thanks - yes I was thinking along those lines. Just wanted to make sure there wasn't some cool function I was missing out on.

For completeness, here is my script, if anyone else has the same issue. Since a lot of the screens are similar and require the same input, I switched to using a ContinueLoop instead, and only break out if we reach the last form or if we time out. Interestingly I had to use ActivateForm in one instance, probably because the old version uninstaller pops up in front of the new version installer (in the upgrade scenario), but still it was a little odd because it looked like the right form had focus.

Thanks for the help!

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_outfile=AutoIt_InstallWinPcap_4_1_2.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
Run("WinPcap_4_1_2.exe")
$iTimer = TimerInit()
$bInUninstall = False
While 1
    Select
        Case WinExists("WinPcap 4.1.2 Setup", "WinPcap 4.1.2 Installer")
            Send("!n")
            ContinueLoop
        Case WinExists("WinPcap 4.1.2 Setup", "Welcome")
            Send("!n")
            ContinueLoop
        Case WinExists("WinPcap 4.1.2 Setup", "License Agreement")
            Send("!a")
            ContinueLoop
        Case WinExists("WinPcap 4.1.2 Setup", "Installation options")
            Send("!i")
            ContinueLoop
        Case WinExists("WinPcap 4.1.2 Setup", "WinPcap 4.1.2 is already installed")
            Send("{ESC}")
            ExitLoop
        Case WinExists("WinPcap 4.1.2 Setup", "A previous version")
            $bInUninstall = True
            Send("!y")
            ContinueLoop
        Case WinExists("WinPcap 4.1.2 Setup", "The uninstaller")
            Send("{ENTER}")
            ContinueLoop
        Case WinExists("WinPcap", "Uninstall WinPcap")
            Send("!u")
            ContinueLoop
        Case WinExists("WinPcap", "Completing")
            WinActivate("WinPcap", "Completing")
            Send("!f")
            If $bInUninstall Then
                $bInUninstall = False
                ContinueLoop
            Else
                ExitLoop
            EndIf
        Case TimerDiff($iTimer) >= 8000
            MsgBox(16, "WinPcap Auto-installer", "Installation of WinPcap failed")
            Exit
    EndSelect
WEnd
Link to comment
Share on other sites

  • 11 months later...

Hi - it is a year later and I am trying to use this same script to install WinPcap with a different product. However this time it does not appear to be working 100%. Watching the script in action, it appears to successfully install WinPcap, however running my product fails until I manually install WinPcap.

I did a system diff (files, registry, everything) of the machine - one taken after running the autoit script, and one taken after manually installing. There was a difference, a single registry entry hiding out under "CurrentControlSet".

I don't expect you all to be familiar with this product but are there any general troubleshooting ideas out there, or likely culprits for this type of issue?

Here is my script in its current state. Thanks!

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=AutoIt_InstallWinPcap_4_1_2.exe
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
;#Include <File.au3>
;_FileWriteLog("c:AutoIt.log", "Starting WinPcap 4.1.2 installer");
Run("WinPcap_4_1_2.exe")
$iTimer = TimerInit()
$bInUninstall = False
While 1
Select
  Case WinExists("WinPcap 4.1.2 Setup", "WinPcap 4.1.2 Installer")
   ;_FileWriteLog("c:AutoIt.log", "Encountered 'WinPcap 4.1.2 Installer'");
   Send("!n")
   ContinueLoop
  Case WinExists("WinPcap 4.1.2 Setup", "Welcome")
   ;_FileWriteLog("c:AutoIt.log", "Encountered 'Welcome'");
   Send("!n")
   ContinueLoop
  Case WinExists("WinPcap 4.1.2 Setup", "License Agreement")
   ;_FileWriteLog("c:AutoIt.log", "Encountered 'License Agreement'");
   Send("!a")
   ContinueLoop
  Case WinExists("WinPcap 4.1.2 Setup", "Installation options")
   ;_FileWriteLog("c:AutoIt.log", "Encountered 'Installation options'");
   Send("!i")
   ContinueLoop
  Case WinExists("WinPcap 4.1.2 Setup", "WinPcap 4.1.2 is already installed")
   ;_FileWriteLog("c:AutoIt.log", "Encountered 'already installed'");
   Send("{ESC}")
   ExitLoop
  Case WinExists("WinPcap 4.1.2 Setup", "A previous version")
   ;_FileWriteLog("c:AutoIt.log", "Encountered 'A previous version'");
   $bInUninstall = True
   ;_FileWriteLog("c:AutoIt.log", "Set InUninstall TRUE");
   Send("!y")
   ContinueLoop
  Case WinExists("WinPcap 4.1.2 Setup", "The uninstaller")
   ;_FileWriteLog("c:AutoIt.log", "Encountered 'The uninstaller'");
   Send("{ENTER}")
   ContinueLoop
  Case WinExists("WinPcap", "Uninstall WinPcap")
   ;_FileWriteLog("c:AutoIt.log", "Encountered 'Uninstall WinPcap'");
   Send("!u")
   ContinueLoop
  Case WinExists("WinPcap", "Completing")
   ;_FileWriteLog("c:AutoIt.log", "Completing'");
   WinActivate("WinPcap", "Completing")
   Send("!f")
   If $bInUninstall Then
    ;_FileWriteLog("c:AutoIt.log", "Set bInUninstall FALSE");
    $bInUninstall = False
    ContinueLoop
   Else
    ;_FileWriteLog("c:AutoIt.log", "Exit with Finish command");
    ExitLoop
   EndIf
  Case TimerDiff($iTimer) >= 60000
   ;_FileWriteLog("c:AutoIt.log", "TimerDiff > 60000, exiting");
            MsgBox(16, "WinPcap Auto-installer", "Installation of WinPcap failed")
            Exit
EndSelect
WEnd
;WinWaitActive("WinPcap 4.1.2 Setup", "WinPcap 4.1.2 Installer")
;Send("!n")
;WinWaitActive("WinPcap 4.1.2 Setup", "Welcome")
;Send("!n")
;WinWaitActive("WinPcap 4.1.2 Setup", "License Agreement")
;Send("!a")
;WinWaitActive("WinPcap 4.1.2 Setup", "Installation options")
;Send("!i")
;WinWaitActive("WinPcap 4.1.2 Setup", "Completing")
;Send("!f")
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...