computerguy4513 Posted December 10, 2021 Share Posted December 10, 2021 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 More sharing options...
Solution Luke94 Posted December 10, 2021 Solution Share Posted December 10, 2021 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 computerguy4513 1 Link to comment Share on other sites More sharing options...
computerguy4513 Posted December 10, 2021 Author Share Posted December 10, 2021 Thank You for the help! I'll try it! Link to comment Share on other sites More sharing options...
computerguy4513 Posted December 10, 2021 Author Share Posted December 10, 2021 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 More sharing options...
Luke94 Posted December 10, 2021 Share Posted December 10, 2021 Add this: ConsoleWrite('I made it here!' & @CRLF) After the Do... Until loop. Run it and let me know if you see the output in the Console. I'm thinking you're gonna need IUI Automation. Link to comment Share on other sites More sharing options...
Luke94 Posted December 10, 2021 Share Posted December 10, 2021 Just spotted this: 'Logon.exe - User Logon (v4.09')' ; ^ Should be: 'Logon.exe - User Logon (v4.09)' Quite a lot of occurances. Link to comment Share on other sites More sharing options...
computerguy4513 Posted December 10, 2021 Author Share Posted December 10, 2021 Thanks Luke94. I'm an idiot. I copied the modified .exe as login_test.exe and ran login.exe again to test. I ran the RIGHT one, and it behaved properly. Thanks again! The grammar syntax was from me editing out important titles to generic ones for security sake. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now