Sign in to follow this  
Followers 0
es1984

MouseClick() doesn't work following WinActivate()

5 posts in this topic

MouseClick() is not working following the use of WinActivate(), whilst the mouse moves to the correct location the click action does not appear to action. Code as follows:

#RequireAdmin
Opt("MouseCoordMode",0)
WinActivate("wePresent WiPG-1000" , "")
MouseClick("left",267,11,2,1)

If i remove the WinActivate() command and switch to absolute coords as follows, it works.

#RequireAdmin
Opt("MouseCoordMode",1)
MouseClick("left",400,400,2,1)

Why is use of WinActivate() resulting in this issue? How do I overcome.

Thanks

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

The title your using is wrong thus it can't find the window. Try this:

#RequireAdmin 
#include <MsgBoxConstants.au3>
Opt("WinTitleMatchMode", 2) 
Opt("MouseCoordMode",0) 
WinActivate("wePresent" , "") 


If WinActive("wePresent") Then ; Check if wePresent is currently active.
    MsgBox($MB_SYSTEMMODAL, "", "WinActive" & @CRLF & "wePresent is active.")
Else
    MsgBox($MB_SYSTEMMODAL, "", "WinActive" & @CRLF & "wePresent is not active. Look in the help file for 'Window Titles and Text (Advanced'")
EndIf


;MouseClick("left",267,11,2,1) ;commented out for now to verify if you can activate the window or not. 
;once you can activate the window comment out the If statement above and remove the comment for the mouseclick.

I added Opt("WinTitleMatchMode", 2)  to look for a substring of the window.

Edited by DarthCookieMonster

Share this post


Link to post
Share on other sites

"We present is active" displayed successfully, however same effect when if statement is commented and the mouseclick() uncommented; mouse moves but does not appear to click.

I copied the full title from 'Window Info'. Why do you suspect it is incorrect?

Thanks

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Use controlclick...skip the inaccuracy of attempting to click coords...only game automation needs click coords (99% of the time, at least).

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  
Followers 0