Help with moving mouse to a position, left click and repeat in different position

Ask gaming related questions (AHK v1.1 and older)
stevied71
Posts: 1
Joined: 06 Jan 2018, 19:55

Help with moving mouse to a position, left click and repeat in different position

06 Jan 2018, 20:19

Hi All,

Been trying to to get a script to work that does the following:

when a particular game is running, when I click the * key then move mouse to position A, left click, move to position B, left click.

AHK allows the script below to run, but when I click on the * key nothing happens.

#IfWinActive ("ahk_class xxx") && ("ahk_exe xxx.exe")
*::
MouseMove, 939, 985
MouseClick, Left
MouseMove, 831, 168
MouseClick, left
return

I've tried using the SetCursorPosition

#IfWinActive ("ahk_class xxx") && ("ahk_exe xxx.exe")
*::
DllCall("SetCursorPos", int, 939, int, 985)
MouseClick, Left
DllCall("SetCursorPos", int, 831, int, 168)
MouseClick, left
return

And also
#IfWinActive ("ahk_class xxx") && ("ahk_exe xxx.exe")
*::
SendEvent {Click 939, 985}
MouseClick, Left
SendEvent {Click 831, 168}
MouseClick, left
return

I've also removed the IfWinActive line for all three, none work.

What am I missing?
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Help with moving mouse to a position, left click and repeat in different position

07 Jan 2018, 02:20

You might want: NumpadMult::
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: Bing [Bot] and 86 guests