Suspend when black color found

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
daivariuks1
Posts: 1
Joined: 23 Jul 2021, 04:23

Suspend when black color found

25 Jul 2021, 11:34

I want to make a script, so when i press a hotkey it searches for black color, and if its found it suspends the script, if its not found then unsuspends the script.
I wrote it like this:

Code: Select all

*t::
PixelSearch, Px, Py, 10, 175, 850, 450, 0x000000, 1, fast 
If (ErrorLevel = 0) {
	suspend, on
} 
else if (ErrorLevel = 1) {
	suspend, off
}
[Mod edit: [code][/code] tags added.]

The hotkey suspends the script by itself, is it possible to stop that?
User avatar
mikeyww
Posts: 26877
Joined: 09 Sep 2014, 18:38

Re: Suspend when black color found

25 Jul 2021, 12:32

Code: Select all

t::
Suspend, Permit
PixelSearch,,, 10, 175, 850, 450, 0,, Fast
Suspend, % ErrorLevel = 1 ? "Off" : ErrorLevel ? A_IsSuspended : "On"
Return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 208 guests