Author Topic: Voice command and key presses  (Read 816 times)

jcdick1

  • Jr. Member
  • **
  • Posts: 59
Voice command and key presses
« on: November 17, 2024, 04:43:22 PM »
What would be the best way to do a command that provides for using either voice or a key press?

The idea being, if I speak a command, VA sends the keystroke and does some other things.  If I press the key myself, it still triggers VA to do the other things.  Do I need to do it as two commands, or use a conditional with the device state to determine if the command is triggered by voice or keystroke?  Or is there a better way?

Thanks.

SemlerPDX

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 293
  • Upstanding Lunatic
    • My AVCS Homepage
Re: Voice command and key presses
« Reply #1 on: November 17, 2024, 07:43:10 PM »
Commands in VoiceAttack can be triggered by the "When I say" phrase, a keyboard key or key combo, joystick/controller or mouse button.  All of these options are available for every command regardless of whether another was also used.  We can also trigger commands through various conditional means in the Profile Options under the "Profile Exec" tab along the top, through plugins or inline functions, or via actions inside other commands or profiles.



Inside any single command, you can make it trigger upon recognition of a speech phrase and also trigger upon a keyboard key or key combo.  If you needed to determine how the command was triggered for some reason, you can do so using the text token {CMDACTION}.

Quote
The value [of {CMDACTION}] will be, 'Spoken' if the command was executed by a spoken phrase, 'Keyboard' if the command
was executed using a keyboard shortcut ...

Read more about Tokens around page 164 of the VoiceAttack Help Manual - you can find this {CMDACTION} token and its full description around page 167.

jcdick1

  • Jr. Member
  • **
  • Posts: 59
Re: Voice command and key presses
« Reply #2 on: November 17, 2024, 07:53:34 PM »
{CMDACTION} seems to be what I was looking for then, because it is to determine if the command was triggered by voice or by keyboard.  I was reading through the PDF and saw the Conditional for if a key is pressed, thinking I would have to wrap the whole thing in that to differentiate.  I appreciate the clue!

Thanks!