Need some help with a simply ahk

Get help with using AutoHotkey and its commands and hotkeys
Posts: 1
Joined: 07 Jan 2020, 14:53

Need some help with a simply ahk

07 Jan 2020, 15:10

I was trying to do a simply ahk, but i dont have enough knowledge do to it. So anyone can help? i need to the script first click with Rmousebutton move to other location click with Lmousebutton. then move to new location then Rmousebutton and finally move to another location and Lmousebutton. And some button like press f1 to start/stop the loop. any ideas?

Code: Select all

MouseMove, X, Y , Relative
SendEvent {Click 233, 335}
ControlClick, x233 y335

MouseMove, X, Y , Relative
SendEvent {Click 333, 514}
ControlClick, x333 y514

MouseMove, X, Y , Relative
SendEvent {Click 433, 467}
ControlClick, x433 y467

MouseMove, X, Y , Relative
SendEvent {Click 333, 514}
controlClick, x333 y514
[Mod edit: [code][/code] tags fixed.]
Posts: 49
Joined: 16 Jul 2017, 14:49
GitHub: mshafer1

Re: Need some help with a simply ahk

07 Jan 2020, 19:56

To right click, call `MouseClick` with `right` as an argument: (MouseClick)

Code: Select all

MouseClick, Right
Or, Send,

Code: Select all

Send, {RButton}
To move, use MouseMove:

Code: Select all

MouseMove, 10, -10,,R
(the R makes it relative even if CoordMode isn't set).

For looping till a key is pressed, checkout this previous thread:

For toggling, check out this previous thread on toggling keys on and off:

So, put it all together, and you might get:

Code: Select all

; (tested with just LButton)

	RepeatKey := !RepeatKey  ; create boolean variable to keep track of toggle
	If RepeatKey
		SetTimer, mouseLoop, 1000  ; call mouseLoop every ~1e3 mS (1S)
		SetTimer, mouseLoop, Off  ; stop mouseLoop

	Send, {RButton}  ; R-Click

	MouseMove, -10,0,,R  ; Move-Left

	Send, {LButton}  ; L-Click

	MouseMove, 0,10,,R  ; Move-Down

	Send, {Rbutton}  ; R-Click

	MouseMove, 10,0,,R  ; Move-Right

	Send, {LButton}  ; L-Click

	MouseMove, 0,-10,,R ; Move-Up

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], songdg, Xtra and 50 guests