I want to run this in the background, so I can work on other projects and this script not take control of my mouse and have the Monitor window minimized.
#Region
#AutoIt3Wrapper_UseX64=n
#EndRegion
#include <ImageSearch.au3>
HotKeySet("{s}", "StartScript")
HotKeySet("{z}", "PauseScript")
HotKeySet("{q}", "QuitScript")
Global $Start = 0
Global $Light = 0
Global $LightX = 0
Global $LightY = 0
WinActivate("Monitor")
Func StartScript()
$Start = 1
EndFunc
Func Light()
Local $Light = _ImageSearcharea("LightOn.bmp", 1, 960, 0, 1440, 270, $LightX, $LightY, 100)
If $Light = 1 Then
MouseClickDrag("Left", $LightX, $LightY, $LightX+72, $LightY, 1)
Send("^c")
Run("notepad.exe")
WinWaitActive("Untitled - Notepad")
Send("^v")
EndIf
EndFunc
Func PauseScript()
$Start = 0
EndFunc
Func QuitScript()
Exit
EndFunc
While 1
If $Start = 1 Then
Light()
EndIf
Sleep(1000)
WEnd
As for the program, it's just called Monitor. It's a basic GUI that monitor one of the controllers in the plant.