Search for specific colors, left click one time if found

Get help with using AutoHotkey and its commands and hotkeys
rexboo
Posts: 2
Joined: 14 Jun 2019, 16:50

Search for specific colors, left click one time if found

14 Jun 2019, 16:56

Hi All,

Can you please help me with the problem that i'm facing writing this script.

Basically what it needs to do is;
1- Search a part of the screen for the specified colors
2- If a specific color is found click on it
3- Repeat

So it needs to click to some colors in the game as quickly as possible.

Thanks a lot!
rexboo
Posts: 2
Joined: 14 Jun 2019, 16:50

Re: Search for specific colors, left click one time if found

14 Jun 2019, 17:06

I found this code but its not able to find the color that i want in a specified area, not sure why. Also, Is it possible to search for 3 colors instead of one?

Code: Select all

IF NOT A_IsAdmin ; Runs script as Admin.
{
   Run *RunAs "%A_ScriptFullPath%"
   ExitApp
}

#MaxThreadsPerHotkey, 2
CoordMode, Pixel, Screen
#singleInstance, Force
toggle = 0


F8::  ; press F8 to toggle the loop on/off.
SoundBeep
Toggle := !Toggle
While Toggle
{ ;-- Begin of loop.
PixelSearch, colourx, coloury, 632, 646, 812, 841, 0x3f627f, 0, Fast RGB 

IF ErrorLevel = 1 	; IF NOTFound.	
{
sleep, 1000
}

IF ErrorLevel = 0 	; IF Found.	
{
Click, %colourx%, %coloury% Left, 1 	; Click on it.						
sleep, 1000
}

} ;-- End of Loop.
return

Return to “Ask For Help”

Who is online

Users browsing this forum: Albireo, Bing [Bot], Google [Bot], gummby8, kostons, MannyKSoSo, natester002, RickC, teadrinker and 180 guests