I am trying to use AHK to make generating some yearly reports easier, but I have found a problem and I am unsure how to fix it. I am using an imagesearch loop to check if a report has finished generating and can be converted to PDF, but I realized if there is no data to generate a report with, obviously this loop hangs indefinitely. After setting up a solution (second imagesearch with a match to the "no data" message), I realized that I don't want the script to continue with it's normal loop as those inputs can break the next loop. What would be the simplest way to tell AHK to increment a variable and restart the loop?
Current code as below:
Code: Select all
Loop %var2%
{
MouseClick, L, 469, 334
Send, {Blind}0101%var1% ;Year Start
MouseClick, L, 467, 356
Send, {Blind}1231%var1% ;Year End
MouseClick, L, 465, 535 ;Preview
Loop
{
ImageSearch, , , 125, 225, 750, 275, PASS.png
if ErrorLevel = 0
break ; image was found break loop and continue
ImageSearch, , , 195, 395, 300, 440, FAIL.png
if ErrorLevel = 0
break ; image was not found break loop and continue
}
... more code...
var1++
}