Author Topic: Use a voice command in a variable keypress  (Read 3004 times)

errspace

  • Guest
Use a voice command in a variable keypress
« on: March 21, 2019, 02:06:55 AM »
Sorry for the bad description, it's difficult to explain.

I have a dynamic command which includes numbers - some of those numbers translate directly to numeric keys. In other words, saying "one" should fire CTRL+1, saying "two" should fire CTRL+2, etc.

I'm trying to avoid using individual if-else conditions for each number because the command already generates 400 sub-commands, and I feel like variable keypresses should work for this with much more brevity. I'm not doing it right though. I tried setting a variable from the number then feeding that to the VK, e.g.
Code: [Select]
[CTRL][keyOne]
...but that didn't work, and nor did
Code: [Select]
[CTRL]{CMDSEGMENT:2}
Is there some way to do this please?

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Use a voice command in a variable keypress
« Reply #1 on: March 21, 2019, 01:38:01 PM »
Variable Keypress takes a text variable, like this:
Code: [Select]
Set Text [~keyPress] to '[CTRL]{CMDSEGMENT:2}'
Press variable key(s) [~keyPress] and hold for 0,06 seconds and release

If you enter "[CTRL]{CMDSEGMENT:2}" into the "Variable Keypress (Advanced)" textbox, it'll look for a variable with that literal name.


You can skip the intermediate variable by using Quick Input instead, though the key indicators for that are slightly different, so it'd be
Code: [Select]
Quick Input, '[CTRLDOWN]{CMDSEGMENT:2}[CTRLUP]'

errspace

  • Guest
Re: Use a voice command in a variable keypress
« Reply #2 on: March 21, 2019, 04:25:24 PM »
Perfect, thank you.

Agent86

  • Jr. Member
  • **
  • Posts: 55
Re: Use a voice command in a variable keypress
« Reply #3 on: April 21, 2019, 08:20:12 AM »
Variable Keypress takes a text variable, like this:
Code: [Select]
Set Text [~keyPress] to '[CTRL]{CMDSEGMENT:2}'
Press variable key(s) [~keyPress] and hold for 0,06 seconds and release

If you enter "[CTRL]{CMDSEGMENT:2}" into the "Variable Keypress (Advanced)" textbox, it'll look for a variable with that literal name.


You can skip the intermediate variable by using Quick Input instead, though the key indicators for that are slightly different, so it'd be
Code: [Select]
Quick Input, '[CTRLDOWN]{CMDSEGMENT:2}[CTRLUP]'


High what does this "Code:[Select] mean regarding Variable Keypress. Is this actually written into the Variable Keypress field ? Or is this the function of the Keypress field already ?

Trying to learn how the keypress field works and what commands I should be looking to put there ?
Is there any documentation on the Keypress field ?

Please advise
Thanks

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Use a voice command in a variable keypress
« Reply #4 on: April 21, 2019, 08:59:33 AM »
Press F1 while VoiceAttack has focus to open VoiceAttackHelp.pdf.

Basic documentation for the variable keypress field can be found on pages 30 and 31.



High what does this "Code:[Select] mean regarding Variable Keypress. Is this actually written into the Variable Keypress field ? Or is this the function of the Keypress field already ?
If you mean the literal string "Code:[Select]", that's part of the forum's code tags and has nothing to do with VoiceAttack itself.

What's in those tags are the contents of the action list in the "Edit a Command" window, from which can be derived which actions to use within a command to achieve a given result.

Agent86

  • Jr. Member
  • **
  • Posts: 55
Re: Use a voice command in a variable keypress
« Reply #5 on: April 22, 2019, 01:22:08 PM »
Thanks, all