Quantcast
Channel: AutoHotkey Community
Viewing all articles
Browse latest Browse all 579

Ask for Help (v2) • Re: pixelsearch timing help

$
0
0
Hi.

You probably want to run PixelSearch in a loop for a certain amount of time, right?
If so, here is an example of what it could look like.

CODE:

#Requires AutoHotkey 2.0
#SingleInstance


F4::ExitApp
F1:: {

CoordMode "Pixel"
TimeOut := 5000 ; 5s

Loop {

ToolTip "Step 1" ; do something here
SoundBeep 200
Sleep 1000

ToolTip "Step 2" ; pixelsearch for 'amount of time' and if time runs out then go back to step 1
SoundBeep 400
Sleep 1000
Found := false
Start := A_TickCount
while A_TickCount-Start <= TimeOut {

if PixelSearch(&OutputVarX, &OutputVarY, 0, 0, 500, 500, 0x2F7DEE) {
Found := true
break
}
}

if Found { ; but if pixelsearch finds the color then go to step 3

ToolTip "Step 3"
SoundBeep 600
Sleep 1000
}
}
}

Statistics: Posted by Noitalommi_2 — Today, 17:36



Viewing all articles
Browse latest Browse all 579

Trending Articles