Oops.. there was no (e) . I'm a little overzealous to get this working I guess

Good thinking regarding the status polling. Fixed it now.
Ive figured (d) out. When you click the text cursor (for 0.8 seconds in the text field) to trigger the Voice recognition to turn on, the process of sending the F10 key is actually taking focus away from the RR CDRIP app. This causes the LOADING screen to be seen. Pressing ESC goes back to the main menu and the entire app is still running correctly (thinking that it has been told to stop voice recognition etc).
Test: I replaced the send F10 to RR with send "5" to Calculator, the app worked perfectly and CDRIP DID NOT lose focus from the OSK screen.
[All testing was done on BMV2.]
Any other ways to trigger the Voice recognition plugin to ON?
Can the plugin be recoded to include this option?
I would almost prefer it if the plugin wasnt waiting for a hotkey, purely turning the Mic input ON/OFF.
I tried the following commands to send the F10 key - all result in LOADING screen:
1. ControlSend("RoadRunner","","","{F10}")
2. $Voice = WinGetHandle("RoadRunner", "")
WinActivate($Voice, "")
Send("{F10}")
Anyway, heres my current code:
Code:
#Include <Misc.au3>
AutoItSetOption("WinTitleMatchMode", 3)
$test = "test"
$SpeechOn = -1
$PlayStatus = -1
If WinExists($test) Then Exit
AutoItWinSetTitle($test)
$rr=ObjCreate("RoadRunner.sdk")
if not IsObj($rr) then Exit
$oMyError = ObjEvent("AutoIt.Error","MyErrFunc")
HotKeySet("!{esc}", "_exit") ;for testing only, exit ALT+ESC disable when no need for it.
While 1
If $oMyError.windescription then
if Not WinExists("RoadRunner") then ExitLoop ;exit if RR is not Running.
EndIf
If MouseGetCursor() = 5 And _IsPressed("01") then
;Mouse has been clicked where the User wants to dictate
If ($rr.getinfo("STATUS") = "Play") Then ;Check the previous play/pause/stop status
$rr.Execute("pause") ;Pause music ;if playing, then pause the music, else skip
$PlayStatus = 1
EndIf
;ControlSend("RoadRunner","","","{F10}") ; this does the same as the 3 code lines below - but is slightly less obtrusive
;the above line tries to tell the Voice Recog plugin to start accepting dictation
$Voice = WinGetHandle("RoadRunner", "") ;trigger hotkey line 1
WinActivate($Voice, "");trigger hotkey line 2
Send("{F10}");trigger hotkey line 3
$SpeechOn= 1 ; Tells the app that it is about to receive speech commands
EndIf
Sleep (800) ;push and hold for 0.8 seconds to engage Voice control
While (MouseGetCursor() = 5 And $SpeechOn = 1) Or (Not(_IsPressed("01")) And Not(MouseGetCursor() = 5) And $SpeechOn = 1)
;Above line checks that EITHER:
;a)The cursor is a text cursor (Ibeam) and it doesnt care if its being left clicked; or
;b) The cursor is NOT a text cursor (Ibeam) but thats OK, as long as the user isnt left clicking on anything - purely moving the mouse around!
; While we are waiting for the speech input, we make sure that the cursor stays as a TEXT CURSOR and is in speech mode
; Just sit here and do nothing. This means the app will wait till the
; ..user finishes talking and issues their "ENTER" command
WEnd
If Not(MouseGetCursor() = 5) And $SpeechOn = 1 Then ;As soon as the user gives the ENTER command - This needs work!
;Place code here for
;turn mic off /hotkey - mic has auto-off it seems
$rr.Execute("ENTER") ;press enter/submit text - doesnt always work
If ($rr.getinfo("STATUS") = "PAUSE") AND ($PlayStatus = 1) Then ;at the top we checked if RR was playing/paused/stopped, if playing this resumes, else skips over
$rr.Execute("resume") ;resume audio
$PlayStatus = -1
EndIf
$SpeechOn = 0 ; Turn off voice commanding - ignore incoming commands/turn mic off
EndIf
WEnd
;==============================================================================================
;AI's error reporting Object
;==============================================================================================
Func MyErrFunc()
Local $err = $oMyError.number
If $err = 0 Then $err = -1
SetError($err)
Endfunc
Func _exit()
Exit
EndFunc
EDIT: changed code to use the '$voice' method (simply changed commenting), as method 1 didnt always work
(ControlSend("RoadRunner","","","{F10}"))
Ice