Jump to content
Sign in to follow this  
idontknow989

WinExists Issue

Recommended Posts

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

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

 


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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
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 by Chimp
added p.s.

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

Share this post


Link to post
Share on other sites

your suggestion is a right example of how to fix it, just in the wrong spot (and control) :).

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.

Share this post


Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...