Jump to content
Unholy_Pony

Using WinGetCaretPos and MouseClick

Recommended Posts

Unholy_Pony

Greetings all,

I'm trying to use WinGetCaretPos and MouseClick in concert. I *think* this should work, but it doesn't. Any ideas would be much appreciated.

;Below this fills out a field and moves the carat into the position to copy the x/y location
SEND("loc{TAB}")

;LOCATION FIELD, I want this to grab the x coord position from the array and put it into the mouseclick below.
Local $aCaretPos3 = WinGetCaretPos()
local $sVariable1 = $aCaretPos3[0]

;plug the variable into the mouseclick. It changes every instance, so it needs to refresh with loop.
_WinWaitActivate("New service work order","")
MouseClick("left",$sVariable1,385,1,0)

;rest of script that works great.

 

Working script with carat trials.au3

Edited by Unholy_Pony

Share this post


Link to post
Share on other sites
Zedna

WinGetCaretPos() returns position relative to foreground window but MouseClick() has absolute (desktop) position.

So you have to get position of your window by WinGetPos() and add your caret's X value to window's X value.

Edited by Zedna
  • Like 1

Share this post


Link to post
Share on other sites
Unholy_Pony

Thanks for the response Zedna. :) Does using Opt('MouseCoordMode',0)  change that setting? 

 

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

×