Author Topic: Change Listening state based on Window focused or .exe open  (Read 1417 times)

tonymaxbirt

  • Guest
Change Listening state based on Window focused or .exe open
« on: August 31, 2018, 02:36:29 PM »
I have VA always in listening mode.  What I am trying to achieve is to get Voice attack to stop listening when a window (Retroarch) is focused or the retroarch.exe is detected, then to start listening again when the window is no longer focused or the .exe is closed, how would I go about this?

Thanks
Tony

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Change Listening state based on Window focused or .exe open
« Reply #1 on: August 31, 2018, 03:58:23 PM »
One option is to use the built-in profile switcher to switch to and from a profile that will toggle the listening state by using the "Execute a command each time this profile is loaded" option.

The single command in that profile would look something like this:
Code: [Select]
Begin Device State Check :  Keyboard Key 'Shift' Is Pressed
End Condition - Exit when condition met
Stop VoiceAttack listening
Start Loop While : [{ACTIVEWINDOWTITLE}] Contains 'Retroarch'
End Loop
Start VoiceAttack listening
Switch to profile, '{PREVIOUSPROFILE}' (by name)
It'll monitor a key which you can hold down when switching to the profile manually so you can modify the command/profile while the target application is not running(otherwise it'll switch back to the previous profile right away).


More information on profile auto-switching can be found in VoiceAttackHelp.pdf page 12 and 13

If you want to check for a process instead(which the auto-switcher supports), you'll also want to swap the {ACTIVEWINDOWTITLE} token for the {PROCESSEXISTS:} token, and set a text variable for the latter to use.