Code: Select all
Gui,+AlwaysOnTop
gui, add, button, x15 y5 h20 w120 gsub1, Tick
gui, add, button, x15 y30 h20 w120 gsub2, Untick
gui, add, button, x40 y60 h20 w70 greload, Reload
gui, add, button, x40 y85 h20 w70 gexit, Exit Script
gui, show, x380 y100 w150 h120
Return
sub1:
{
CoordMode, Pixel, Relative
ImageSearch, FoundX, FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, %A_ScriptDir%\tickempty.png
if ErrorLevel = 2
MsgBox Could not conduct the search.
else if ErrorLevel = 1
MsgBox Icon could not be found on the screen.
else
MouseGetPos, posx, posy
MouseClick, Left, Foundx + 5, FoundY +5
WinActivate, %A_ScriptName%
MouseMove, posx, posy
Return
}
Return
sub2:
{
CoordMode, Pixel, Relative
ImageSearch, FoundX, FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, %A_ScriptDir%\tick.png
if ErrorLevel = 2
MsgBox Could not conduct the search.
else if ErrorLevel = 1
MsgBox Icon could not be found on the screen.
else
MouseGetPos, posx, posy
MouseClick, Left, Foundx + 5, FoundY +5
WinActivate, %A_ScriptName%
MouseMove, posx, posy
Return
}
Return
reload:
Reload
guiclose:
exit:
{
exitapp
}
Return