I use the script below
Code: Select all
#SingleInstance, Force
CoordMode, Pixel, Screen
first_press := true ; start your flag variable with a default value
pressed := false
while !pressed ; wait until the first time Printscreen is pressed before starting main loop
Sleep, 100
pressed := false ; after it is made true by pressing Printscreen, turn it back to false
loop
{
if (first_press)
{
while !pressed
{
PixelGetColor, Switch, 1209, 209, RGB
if (Switch != 0x666055 && Switch = 0x2A2A2B)
Send, {A}
sleep, 200
}
pressed := false ; after it is made true by pressing Printscreen, turn it back to false
first_press := false
}
else
{
while !pressed
{
PixelGetColor, Switch, 1209, 209, RGB
if (Switch != 0x2A2A2B && Switch = 0x666055)
Send, {A}
sleep, 200
}
pressed := false ; after it is made true by pressing Printscreen, turn it back to false
first_press := true
}
}
return
PrintScreen::pressed := true
and when I press to deactivate it looks for another certain color in the same coordinate.
use the "A" key in both cases, however I would like to use the "A" key to start instead, I would like to use the "A" key because I need to implement more searches and each search would be started with a specific key.
below I will leave the keys, the colors that will search when activated, the colors that will search when I want to deactivate and the coordinates
PS:
making everything work like a switch when turned on it would be in loop mode checking all the time, but when I press the same key to turn it off it would pause the script completely, only turning it on again when any of the defined keys were pressed again.
Keys: ------------------------------------- Colors -------------------------------------------------------------------------- Coordenates
(A) ------------------------------------- switched on : 0x666055 ----------- off : 0x7AAFAD -------------------------- x1233, y212,
(B) ------------------------------------- switched on : 0xB7972B ----------- off : 0xAF7A88 -------------------------- x1312, y218,
(C) ------------------------------------- switched on : 0xB79DA2 ----------- off : 0xC07DB9 ------------------------- x1428, y235,
(D) ------------------------------------- switched on : 0xDC16BB ----------- off : 0x7D7DC0 ------------------------- x1579, y247,
(E) ------------------------------------- switched on : 0x4416DC ----------- off : 0x7DC08F ------------------------- x1727, y259,
(F) ------------------------------------- switched on : 0x16DCD6 ----------- off : 0xC0A37D ------------------------- x1145, y261,
I really need help, if you have any doubts about my explanation, you can ask me and I will answer as soon as possible.