Code: Select all
F1::
dbg("<HOTKEY> pressed")
SetTimer CheckColor, 10
Gosub CheckColor
Return
Timeout:
dbg("<TIMEOUT> triggered")
SetTimer CheckColor, 10
Gosub CheckColor
Return
CheckColor:
PixelGetColor color, 20, 285, RGB
dbg("CheckColor...", 10, 25, 2)
dbg(Format("Found - 0x{:X}", color), 10, 25, 2)
Tooltip % "^ - Pixel Location", 10, 295, 3
if (color == 0xFFFFFF)
{
dbg("Sending...", 10, 50)
dbg("...Hello", 10, 50)
; Clipboard := "hello"
; Send {Shift Down}{Insert}{Shift Up}
}
else
{
dbg("CheckColor <OFF>", 10, 50)
SetTimer, , Off
dbg("Priming <TIMEOUT>", 10, 50)
SetTimer Timeout, -5000
}
Return
dbg(text, x := 10, y := 0, num := 1) {
static DELAY := 350
ToolTip % Format("[{}]: {}", A_TickCount, text), x, y, num
Sleep DELAY
}
it would appear to me the script is behaving exactly as requested, ie search loop can be restarted with a hotkey on demand and will automatically restart itself after a timeout period if no color was found
if it isnt working, the problem might have to do with the coordinates, color or sending mode