Jump to content

How best to tackle application update with random completion timeframe.


Go to solution Solved by Luke94,

Recommended Posts

Sorry for the poorly worded title, wasn't sure how to concisely word this issue.

 

I have an application that I've scripted an update to. Update runs fine, after running it though, I have to launch the application, login and then close the app.

When launching the application a pop up states that the system is still updating, click ok. I've gone through the process of just setting a long delay before launching the app but it seems completely random, and is a ham fisted solution that I feel could be more elegant. I'm no programmer, just thrust into this position due to employment constriction.

 

What I want the script to do is launch the app, if the box pops up, click ok then wait 10 secs and loop this behavior until the box doesn't box up, and the login box comes up instead.

 

I've previously dabbled in If NOT winwaits, then exit statements which worked really well. However I'm not sure how to continue the script, instead of simply exiting.

 

Link to comment
Share on other sites

  • Solution

Launch the program and then use a Do... Until loop to loop until the login window exists. Inside the loop, use WinGetHandle to check if the pop-up exists and if so click the OK button. After the If statement checking for the pop-up add a sleep for 10 seconds.

Quick example:

Run('Program.exe')
Do
    Local $hWnd = WinGetHandle('Pop-up Window Title')
    If IsHWnd($hWnd) = 1 Then
        If WinActive($hWnd) = 0 Then WinActivate($hWnd)
        ControlClick($hWnd, '', '[CLASS:Button; INSTANCE:1]')
    EndIf
    Sleep(10000)
Until WinExists('Login Window Title') = 1

 

Link to comment
Share on other sites

1 hour ago, Luke94 said:

Launch the program and then use a Do... Until loop to loop until the login window exists. Inside the loop, use WinGetHandle to check if the pop-up exists and if so click the OK button. After the If statement checking for the pop-up add a sleep for 10 seconds.

Quick example:

Run('Program.exe')
Do
    Local $hWnd = WinGetHandle('Pop-up Window Title')
    If IsHWnd($hWnd) = 1 Then
        If WinActive($hWnd) = 0 Then WinActivate($hWnd)
        ControlClick($hWnd, '', '[CLASS:Button; INSTANCE:1]')
    EndIf
    Sleep(10000)
Until WinExists('Login Window Title') = 1

 

#RequireAdmin
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseUpx=y
#AutoIt3Wrapper_Run_Au3Stripper=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

Run('C:\login.exe')
Do
    Local $hWnd = WinGetHandle('Information')
    If IsHWnd($hWnd) = 1 Then
        If WinActive($hWnd) = 0 Then WinActivate($hWnd)
        ControlClick($hWnd, '', '[CLASS:WindowsForms10.Window.b.app.0.ad1; INSTANCE:1]')
    EndIf
    Sleep(10000)
Until WinExists('Logon.exe - User Logon (v4.09') = 1

;Logon.exe Software Update
WinWait('Logon.exe - User Logon (v4.09')', "Change")
WinActivate('Logon.exe - User Logon (v4.09')')
;Click into User ID
ControlClick('Logon.exe - User Logon (v4.09')','','[CLASS:WindowsForms10.EDIT.app.0.ad1;INSTANCE:2]')
;Enter User ID
Send("login")
Sleep(1500)
ControlClick('Logon.exe - User Logon (v4.09')','','[CLASS:WindowsForms10.EDIT.app.0.ad1;INSTANCE:1]')
;Enter Password
Send("Password")
Sleep(1500)
;Click Logon
ControlClick('Logon.exe - User Logon (v4.09')','','[CLASS:WindowsForms10.Window.b.app.0.ad1;INSTANCE:1]')
Sleep(1500)
;Click Continue
ControlClick('Logon.exe - User Logon (v4.09')','','[CLASS:WindowsForms10.Window.b.app.0.ad1;INSTANCE:2]')
Sleep(1500)
;Close Logon.exe
Send ("!{F4}")

Here is my current code. When the "Information" box doesn't show up, the code does not continue to login portion. Script is still active in the system tray, but it doesn't activate the logo.exe user logon dialog and enter the user/pass. What am I missing? Thanks again, I really appreciate you taking time to help me out.

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...