I'm having trouble closing my code. My Esc hotkey doesn't work and rerunning the script and trying to close it that way throws this "Could not close previous instance" error. It was working before. Did I mess with the wrong line of code or something?
Code: Select all
goodZoneCoordX = 1
goodZoneCoordY = 1
run = 1
g::
ZoneSearch:
ImageSearch, goodZoneCoordX, goodZoneCoordY, 0, 0, A_ScreenWidth, A_ScreenHeight, C:\Users\proga\Downloads\zone.png
if (ErrorLevel = 1)
{
Goto, ZoneSearch
}
else
{
goodZoneCoordX -= 50
goodZoneCoordY -= 20
}
while (run = 1)
{
ImageSearch, , , 0, 0, A_ScreenWidth, A_ScreenHeight, C:\Users\proga\Downloads\gameover.png
if (ErrorLevel = 0)
{
run = 0
break
}
else
{
MsgBox, Keep Going!
}
letterKeyCoordX = 0
letterKeyCoordY = 0
ImageSearch, , , goodZoneCoordX, goodZoneCoordY, A_ScreenWidth, A_ScreenHeight, C:\Users\proga\Downloads\Z.png
if (ErrorLevel = 1)
{
ImageSearch, , , goodZoneCoordX, goodZoneCoordY, A_ScreenWidth, A_ScreenHeight, C:\Users\proga\Downloads\X.png
if (ErrorLevel = 1)
{
ImageSearch, , , goodZoneCoordX, goodZoneCoordY, A_ScreenWidth, A_ScreenHeight, C:\Users\proga\Downloads\C.png
if (ErrorLevel = 1)
{
continue
}
else
{
Send, c
}
}
else
{
Send, x
}
}
else
{
Send, z
}
}
return
Esc::ExitApp
return
On a side note, is there a "print"-type statement/command in AHK? I tried using MsgBox to debug but they pause the script which is not helpful. Is there something that'll just output a list of messages or something? I could make and write to a text file but if there's an easier way, I'd love to know.