Need some help with a simply ahk

Get help with using AutoHotkey and its commands and hotkeys
srromanelli
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.]
mshafer1
Posts: 49
Joined: 16 Jul 2017, 14:49
GitHub: mshafer1
Contact:

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: https://autohotkey.com/board/topic/54-loop-until-key-is-pressed/

For toggling, check out this previous thread on toggling keys on and off: https://www.autohotkey.com/boards/viewtopic.php?t=11938

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

Code: Select all

; (tested with just LButton)

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

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