idontknow989 Posted January 12, 2018 Share Posted January 12, 2018 I am trying to check and see if a window pops up and then click a button in the pop up if it does. What ends up happening with my code is the button click does not happen after the window pops up, only when it closes. Is there some way to make the button click happen right after the window pops up? If WinExists ("Address Change") Then WinWait ("Address Change") WinActivate ("Address Change") ControlClick ("Address Change", "", "[CLASS:ThunderRT6CommandButton; INSTANCE:2]", "Left", 1, 38, 9) EndIf Link to comment Share on other sites More sharing options...
careca Posted January 12, 2018 Share Posted January 12, 2018 Why do you even need the winwait? Try to coment it out. Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
idontknow989 Posted January 12, 2018 Author Share Posted January 12, 2018 The mouse click is still happening with winwait commented out. Link to comment Share on other sites More sharing options...
careca Posted January 12, 2018 Share Posted January 12, 2018 What do you mean? The mouse click is supposed to happen, that code should be in a loop waiting for said window to appear. Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
idontknow989 Posted January 12, 2018 Author Share Posted January 12, 2018 Apologies what I meant was the click is not happening when the window pops up. Link to comment Share on other sites More sharing options...
careca Posted January 12, 2018 Share Posted January 12, 2018 If winexists does not trigger, try other methods,window handle, class and so on. Is that the title that appears in the info tool? Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
idontknow989 Posted January 12, 2018 Author Share Posted January 12, 2018 (edited) Here is a picture of the window itself and the OK button I am trying to click. Edited January 12, 2018 by idontknow989 image Link to comment Share on other sites More sharing options...
jdelaney Posted January 12, 2018 Share Posted January 12, 2018 (edited) A lot of the times, when a modal popup like that occurs, the controlclick to open it does not return...it's deadlocked. As soon as the popup is closed, then the controlclick returns, and the script proceeds. You can start another process to click the button that opens that window, or you can do a send at the window while that control is enabled (send enter). Do a help file search for 'command line parameters' to see an example of running one line of code via command line run(). Edited January 12, 2018 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
idontknow989 Posted January 12, 2018 Author Share Posted January 12, 2018 I have tried just using send instead and that did not work. If I set up a separate process would that occur outside the if then statement? Link to comment Share on other sites More sharing options...
jdelaney Posted January 12, 2018 Share Posted January 12, 2018 (edited) You are doing an action, and the reaction is that window comes up...I'm advising you to modify how you perform the action. So no, this is not a change within the if statement. Edited January 12, 2018 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
idontknow989 Posted January 12, 2018 Author Share Posted January 12, 2018 Is there someway I can return control back to my script after a modal window pops up? My script stops completely after the popup comes up. Link to comment Share on other sites More sharing options...
jdelaney Posted January 12, 2018 Share Posted January 12, 2018 I already gave you 2 ways to do so. IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
Gianni Posted January 12, 2018 Share Posted January 12, 2018 ... try something like this variation (not tested) If WinExists("Address Change") Then WinWait("Address Change") $hWinHandle = WinActivate("Address Change") ; get handle of that window ; ControlClick ("Address Change", "", "[CLASS:ThunderRT6CommandButton; INSTANCE:2]", "Left", 1, 38, 9) $sCommandLine = 'ControlClick ("Address Change", "", "[CLASS:ThunderRT6CommandButton; INSTANCE:2]", "Left")' $sCommandLine = '"' & StringReplace($sCommandLine, '"', '""') & '"' ; adjust quotes Run(@AutoItExe & ' /AutoIt3ExecuteLine ' & $sCommandLine) ; click on that button from an external "delegate" EndIf Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
jdelaney Posted January 13, 2018 Share Posted January 13, 2018 That wouldn't work...you'd need to have that run command prior to the click that opens the window...and as written, that will only attempt to click at the time of the run, and not wait for the window or control to exist. IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
Gianni Posted January 13, 2018 Share Posted January 13, 2018 (edited) 7 hours ago, jdelaney said: That wouldn't work...you'd need to have that run command prior to the click that opens the window...and as written, that will only attempt to click at the time of the run, and not wait for the window or control to exist. ...hmm, yes, you are right, as you say I see that the button causing the deadlock is the one previously used to open the popup shown here and not the one in this snippet. Well, then the run command shown in my post above should be used against that previous button (adjusting accordingly the parameters) instead of on this one, and I think it will (should) work... P.S.@jdelaney I remember I had a problem similar to this one, and by searching on the forum I found the post where you already saved my ass once on a similar issue... thanks again.. Edited January 13, 2018 by Chimp added p.s. jdelaney 1 Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
jdelaney Posted January 13, 2018 Share Posted January 13, 2018 (edited) your suggestion is a right example of how to fix it, just in the wrong spot (and control) :). Edited January 13, 2018 by jdelaney Gianni 1 IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. 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