Jump to content

Help with WinWait/ControlClick


Recommended Posts

#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")

Link to comment
Share on other sites

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")

Link to comment
Share on other sites

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")

Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

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