Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
Number = 1
Imagesearch, X, Y, X1, Y1, X2, Y2, *censored*
If ErrorLevel = 2
ExitApp
return
If ErrorLevel = 1
ExitApp
return
If ErrorLevel = 0
return
Lbutton::
Click, 634 676
return
;back
Rbutton::
Click, 747 676
return
;next
Mbutton::
Click, 691 676
return
;pause
Wheelup::
Suspend, On
Sleep 13000
Suspend Off
return
;suspend hotkeys for 13seconds
Wheeldown::
Suspend, On
Sleep 2000
Suspend, Off
Number++
If (Mod(%Number%, 2) = 0) ; if even
{SendMessage, 0x112, 0xF170, 2,, Program Manager
return
}
;turn off monitor
Else
{SendMessage, 0x112, 0xF170, -1,, Program Manager
return
}
;turn on monitor
^w:: ExitApp
Additionally:
I want a msgbox to pop up when there is an error (when errorlevel is 2) saying "Error" and then the script must immediately exit irrespective of whether I interact with anything
And a msgbox to pop up when there is no image found (when errorlevel is 1) saying "Image is not found" and the script must immediately exit irrespective of whether i interact with anything
I tried msgbox but the script never exited. This is confusing hehe.
Thanks!