Author Topic: Get a number from command  (Read 1228 times)

euvgenius

  • Newbie
  • *
  • Posts: 4
Get a number from command
« on: May 11, 2020, 09:57:29 AM »
Hello, I need a key to be pressed specific time in seconds, is it possible to do it without creating N commands?
For example, I say "Hold 50", so the key stays pressed for 50 seconds. I say "Hold 25" and it stays pressed for 25 sec and so on....

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Get a number from command
« Reply #1 on: May 11, 2020, 10:05:34 AM »
Yes, that is possible.

Press F1 while VoiceAttack has focus to open VoiceAttackHelp.pdf in your default PDF viewer, and search for these sections:
"Dynamic command sections"
"{TXTNUM:variableName / value}"
"Variable Pause Screen"
"Key Press Screen"


Keep in mind that commands containing numbers can have a large phrase count, so it's always recommended to only create the phrases you're likely to need (E.G. if you don't need a one-second resolution, use a multiplier).

euvgenius

  • Newbie
  • *
  • Posts: 4
Re: Get a number from command
« Reply #2 on: May 11, 2020, 10:24:01 AM »
Yes, that is possible.

Press F1 while VoiceAttack has focus to open VoiceAttackHelp.pdf in your default PDF viewer, and search for these sections:
"Dynamic command sections"
"{TXTNUM:variableName / value}"
"Variable Pause Screen"
"Key Press Screen"


Keep in mind that commands containing numbers can have a large phrase count, so it's always recommended to only create the phrases you're likely to need (E.G. if you don't need a one-second resolution, use a multiplier).
I can do Hold [1..50] as I see, but I dont understand, how do I put a number from the range into variable?
I think I should use {TXTNUM: variableName / value} somehow, but where do I type it?

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Get a number from command
« Reply #3 on: May 11, 2020, 10:31:50 AM »
Read the introduction to the tokens section ("Text (and Text-To-Speech) Tokens") if you haven't used them before. You'll want to use the "{CMD}" token to get the spoken phrase used to trigger the command, then pass that value to the "{TXTNUM:}" token.

Did you check the "Variable Pause Screen" section/"Add a Variable Pause" action?

euvgenius

  • Newbie
  • *
  • Posts: 4
Re: Get a number from command
« Reply #4 on: May 11, 2020, 10:43:32 AM »
Read the introduction to the tokens section ("Text (and Text-To-Speech) Tokens") if you haven't used them before. You'll want to use the "{CMD}" token to get the spoken phrase used to trigger the command, then pass that value to the "{TXTNUM:}" token.

Did you check the "Variable Pause Screen" section/"Add a Variable Pause" action?
Yes. In Token's section there is a words: "For example, if text variable, ‘myTextNum’
is set to, ‘8675309 Jenny’, {TXTNUM:myTextNum} will return as “8675309”. "
So I have to write {TXTNUM:myTextNum} as Decimal variable name? Or how do I make my variable equal to recognized number?

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Get a number from command
« Reply #5 on: May 11, 2020, 10:50:16 AM »
You don't need a variable.

The "{CMD}" token can be passed to the "{TXTNUM:}" token directly as a literal value (using the syntax specified in the VoiceAttackHelp.pdf section on the "{TXTNUM:variableName / value}" token), and tokens can be used directly in the "Decimal variable name" field of the "Add a Variable Pause" action, as is noted in the "Variable Pause Screen" section of VoiceAttackHelp.pdf

euvgenius

  • Newbie
  • *
  • Posts: 4
Re: Get a number from command
« Reply #6 on: May 11, 2020, 09:59:37 PM »
Got this working, thank you