I've this AHK script that works and does what I need it to do However, there's some stuttering in application when it's running.
Here's what it does: it check a small area (25x25px) of the screen and does ImageSearch loop comparing that area to one of the several icons.
When it finds a match, it enters another smaller loop in which it repeatedly sends a keystroke for that action and checks if this one icon remained on the screen.
Like I said - it is functional, but perhaps great collective will have some advise on optimising it a bit? Thanks!
Code:
#MaxThreadsPerHotkey 3
CapsLock::
#MaxThreadsPerHotkey 1
if RotationLoop
{
RotationLoop := false
return
}
RotationLoop := true
Loop
{
found :=
lastfound := 0
Loop, 7
{
ImageSearch, OutputVarX, OutputVarY, 772, 445, 798, 471, *64 Action_Icon%A_Index%.bmp
if Errorlevel = 0
{
found := A_Index
If found !=
{
Loop
{
Send %found%
sleep 50
ImageSearch, OutputVarX, OutputVarY, 772, 445, 798, 471, *64 Action_Icon%found%.bmp
if Errorlevel != 0
break
}
break
}
}
}
sleep 250
if not RotationLoop
break
}
RotationLoop := false
return