Jump to content
Sign in to follow this  
diikee

Help with WinWait/ControlClick

Recommended Posts

diikee

#include <Date.au3>

#include <Array.au3>

#include <IE.au3>

Opt("WinWaitDelay", 200)

Opt("WinTitleMatchMode", 2)---->partially match the title

Opt("WinDetectHiddenText", 1)

Opt("MouseCoordMode", 0)

$ip = InputBox("IQTEST SUITE", "Enter IP:", "")

;$c = InputBox("Iterations", "No. of iterations<0-5>: ","")

$oIE = _IECreate($ip, 0)

Sleep(2000)

_IELinkClickByText($oIE, "settings")----->works up to this point

Sleep(1000)

WinWait("Connect to "& $ip,"")-----> pops up

If Not WinActive("Connect to "& $ip,"") Then WinActivate("Connect to "& $ip,"")

WinWaitActive("Connect to "& $ip,"")

ControlClick("Connect to "& $ip,"The server","[CLASS:Button; TEXT:OK; Instance:2;]")----> Never gets executed

sleep(1000)

_IELinkClickByText($oIE, "live")

Share this post


Link to post
Share on other sites
sandin
diikee

Yes,

I used the Info Tool and matching any name on the title with the WinTitleMatchMode=2

Mouse instance is 2,

Share this post


Link to post
Share on other sites
diikee

If I use the Script recorder tool, then the script works fine.

MouseMove(239,177)

MouseClick("left")----->>>this is the same as clicking on (linkbytext, "settings")

;MouseUp("left")

WinWait("Connect to "& $ip,"")

If Not WinActive("Connect to "& $ip,"") Then WinActivate("Connect to "& $ip,"")

WinWaitActive("Connect to "& $ip,"")

MouseMove(190,330)

MouseDown("left")

MouseUp("left")

Share this post


Link to post
Share on other sites
diikee

this really puzzles me

#include <Date.au3>

#include <Array.au3>

#include <IE.au3>

Opt("TrayIconDebug", 1)

Opt("WinWaitDelay", 200)

Opt("WinTitleMatchMode", 2)

Opt("WinDetectHiddenText", 1)

Opt("MouseCoordMode", 0)

$ip = InputBox("IQTEST SUITE", "Enter IP:", "")

$oIE = _IECreate($ip, 0)

Sleep(1000)

MouseMove(239,177)

MouseClick("left")

WinWait("Connect to "& $ip,"")

If Not WinActive("Connect to "& $ip,"") Then WinActivate("Connect to "& $ip,"")

WinWaitActive("Connect to "& $ip,"")

MouseMove(834,736)------->>>>This works

MouseDown("left")

MouseUp("left")

_IELinkClickByText($oIE, "settings")

WinWait("Connect to "& $ip,"")

If Not WinActive("Connect to "& $ip,"") Then WinActivate("Connect to "& $ip,"")

WinWaitActive("Connect to "& $ip,"")

MouseMove(834,736)------->>>>This doesn't work.....

MouseDown("left")

MouseUp("left")

Share this post


Link to post
Share on other sites
sandin
diikee

it's an intraweb so, how do I post it??

Share this post


Link to post
Share on other sites
Neo

You can try hosting it somewhere and providing the link but I guess the issue rises from trying to perform the _IELinkClickByText() too fast, before the settings has even loaded on the page.

Try using _IELoadWait() like this:

MouseMove(834,736)------->>>>This works
MouseDown("left")
MouseUp("left")
_IELoadWait($oIE) ;Wait until page is loaded
_IELinkClickByText($oIE, "settings")

I would also recommend that you don't use mouse coordinates as what works now may not work tomorrow because of window size, resolution, etc. _IE functions made by Master Dale Hohm can help you with all this more accurately if you need them.

Edited by Neo

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.