Subroutine basics?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
joe7dust2

Subroutine basics?

17 Jun 2018, 15:09

I have this bit of code that I use to spam click when I go afk.

Code: Select all

Loop
{
click
sleep 150
click
sleep 150
}
return
I would like to make it so that it only runs (toggle script on/off) when I press a certain button. As it is now I just double click the ahk file and alt tab to which program I want the clicks to go to and line it up. Closing it is a little more awkward so this would be much cleaner if only activated by hotkey.

I also want to add a subroutine that is only active after toggling a 2nd hotkey. This one would look for a specific pixel pattern and click it if found. Anyone know how to do this in a beginner friendly way?
Qysh
Posts: 143
Joined: 24 Apr 2018, 09:16

Re: Subroutine basics?

18 Jun 2018, 19:09

I would like to make it so that it only runs (toggle script on/off) when I press a certain button. As it is now I just double click the ahk file and alt tab to which program I want the clicks to go to and line it up. Closing it is a little more awkward so this would be much cleaner if only activated by hotkey.

Hotkeys, Click, GetKeyState

I also want to add a subroutine that is only active after toggling a 2nd hotkey. This one would look for a specific pixel pattern and click it if found. Anyone know how to do this in a beginner friendly way?

Gosub, (PixelSearch/PixelGetColor/ImageSearch)

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Giresharu, supplementfacts and 138 guests