New to AHK scripting, just picked up how to use ImageSearch, but now I would like to improve the quality of life of the script by creating a status. For e.g when the script is running, I would like to have a label text to allow me to know the script is running when it is trying to find the image, and vice versa to know if the script is not running. Tried to change label text when the while loop is running and when its not running but doesn't seem to be working. Any help is appreciated as I am new to this. Thanks!
Gui,2:Add,Button,x10 y10 w200 h40 gFind_Image ,Start Image Search
Gui,2:Add,Button,x10 w200 h40 gGui_1,Load / Reload image
Gui,2:Add, Button,x10 w200 h40 gStop_Music, Stop Music
Gui,2:Add, Text, x10, Press Numpad 1 to stop `n
Gui,2:Add, Text, vStartStop x10, Stop
Gui,2:Add, Text,x20
Gui,2:Show, x1000 y300, Image search
return
2GuiClose:
ExitApp
; StartStop:
; GuiControlGet, Text
; if (Stop:=0)
; {
; GuiControl,, Text, Stop
; Gosub, Start
; }
; else if (Stop:=1)
; {
; GuiControl,, Text, Start
; Gosub, Stop
; }
; return
MyTimer:
if (A_sec <> 10)
return
Settimer, MyTimer, off
Find_Image:
Stop:= 0
While(Stop=0)
{
;ImageSearch, OutputVarX, OutputVarY, X1, Y1, X2, Y2, ImageFile
ImageSearch, FoundX, FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, wizet.png
if(ErrorLevel = 1)
{
;
Traytip,, Image not found, 1
Sleep, 2000
}
else if (ErrorLevel = 0)
{
;play sound as image is found
musicPlay:= 0
;SoundPlay, %W%, wait]
Stop:=1
}
}
return