Jump to content

Recommended Posts

Posted

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

 

Posted

Why do you even need the winwait? Try to coment it out.

  Reveal hidden contents

IUIAutomation - Topic with framework and examples

Au3Record.exe

Posted

What do you mean? The mouse click is supposed to happen, that code should be in a loop waiting for said window to appear.

  Reveal hidden contents

IUIAutomation - Topic with framework and examples

Au3Record.exe

Posted

If winexists does not trigger, try other methods,window handle, class and so on. Is that the title that appears in the info tool?

  Reveal hidden contents

IUIAutomation - Topic with framework and examples

Au3Record.exe

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

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

 

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Posted

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.
Posted (edited)
  On 1/13/2018 at 12:34 AM, 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.

Expand  

...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 by Chimp
added p.s.

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

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
  • Recently Browsing   0 members

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