@Chimp
Finally got around to fixing this and your suggestion worked, and my 1st script finally works, yesss!
Now, I have two questions:
1. I need this script to be on standby the whole time the TTS app is active. So, if I press the hotkey (SPACE) the script will run moving the mouse and clicking at the coordinates and then end. But the next time I press SPACE it should do it again. My question would be is it ok to leave the script running on standby like this for hours on end or is there a more efficient way for the script to run?
2. I need the (SPACE) hotkey to only work in TTS app. So if i go over to a browser window and type SPACE I do not want the script to activate there, only in TTS app. How do I write this into the script?
Here is the current script, I welcome any suggestions!
#AutoIt3Wrapper_UseX64=n ; In order for the x86 DLLs to work
#include "OpenCV-Match_UDF.au3"
_OpenCV_Startup();loads opencv DLLs
_OpenCV_EnableLogging(True,True,True) ;Logs matches, errors in a log file and autoit console output.
HotKeySet( "{SPACE}", "MyFunction")
HotKeySet( "{ESC}", "CloseScript")
Local $x = 342 ; x is first value of mouse position
Local $y = 74 ; y is second value of mouse position
While 1
sleep(10)
Wend
Func MyFunction()
#RequireAdmin
if winexists("Main@TTS") Then
winactivate("Main@TTS")
EndIf
MouseMove($x, $y, 2) ; moves the mouse pointer do mouse position with speed 2
Sleep(500) ; wait 500 ms half of second ( delay )
MouseClick("left", $x, $y, 2, 2) ; now click left mouse key on mouse position, 2 click with speed 2
EndFunc
Func CloseScript()
Exit
EndFunc