Need help creating an AHK macro

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
ahkenjoyer
Posts: 1
Joined: 28 May 2023, 04:39

Need help creating an AHK macro

Post by ahkenjoyer » 28 May 2023, 04:41

Hey, I'm new to this stuff and I need help writing a macro. Would greatly appreciate any help or tips!
So basically I want an AutoHotkey script that would do the following:
After pressing a certain key button (for examble F2), my mouse cursor moves to point A - right clicks - moves to point B - left clicks. Then moves to point A - right clicks - moves to point C - left clicks - to point A - right click - to point D - left click - to point A - right click - to point E - left click - to point A - right click - to point F - left click - to point A - right click - to point G - left click - to point A - right click - to point H - left click - to point A - right click - to point I - left click - to point A - right click - to point J - left click - to point A - right click - (without moving) left click.
I would like to also add a small delay (~30ms) between every action with a way to randomize the delay. But that is optional
image.png
image.png (12.18 KiB) Viewed 265 times

User avatar
mikeyww
Posts: 26600
Joined: 09 Sep 2014, 18:38

Re: Need help creating an AHK macro

Post by mikeyww » 28 May 2023, 06:21

Welcome to this AutoHotkey forum!

Code: Select all

#Requires AutoHotkey v2.0

RClik     := [500, 500]
LClikList := [[600, 600], [700, 700], [800, 800], RClik]
waitMin   := 15
waitMax   := 50

F2:: {
 For each, LClik in LClikList {
  MouseClick 'R', RClik[1], RClik[2]
  Sleep Random(waitMin, waitMax)
  MouseClick 'L', LClik[1], LClik[2]
  Sleep Random(waitMin, waitMax)
 }
}

Post Reply

Return to “Ask for Help (v2)”