Code: Select all
^4:: ;Ferie
Billede:=%A_ScriptDir%\fravaer.png
FindImage(%Billede%)
Mouseclick left
return
FindImage(Image)
{
loopCount := 0
startOfIteration:
loopCount++
while(loopCount < 150)
{
ImageSearch foundX, foundY, 0, 0, 1920, 1080, *30 *w10*loopcount *h-1 %Image%
sleep 30
if(ErrorLevel = 0)
{
;MsgBox image found: %foundX% x %foundY%
MouseMove foundX, foundY, 0
return
}
else if (ErrorLevel = 1)
{
goto startOfIteration
}
else (ErrorLevel = 2)
{
MsgBox Error Something went wrong!
return
}
MsgBox Options Chain Center not found!
}
Return
}
If I embed the filepath in the function without passing it as an argument it works, but obviously that makes it rather pointless as a function.
This kind of makes me suspect that I need a way to tell Billede that it's a variable that's supposed to be storing filepaths, but AHK script is not a typed language so I have no idea how to go about doing that. Help?