Author Topic: I was playing with CMDSEGMENT to create a timer and this happened...  (Read 1202 times)

Boston

  • Newbie
  • *
  • Posts: 18
My command's name is "Timer"
So I said "Timer three minutes four seconds" to maybe write the CMDSEGMENTs to the log when this happened...

Unrecognized : 'Timer 00:03:04'

What!!! VoiceAttack knew I was saying a time and parsed it into HH:MM:SS format!!!

I was trying to avoid "Timer [0..60] minutes [0..60] seconds"... 3721 permutations.

I have read "Variables and tokens summed up" several times. And {TIME} is the current time.
Could someone point me to an example or post for getting minutes and seconds? Thank you.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: I was playing with CMDSEGMENT to create a timer and this happened...
« Reply #1 on: February 20, 2023, 02:03:33 PM »
The Microsoft speech recognition system has a few built-in patterns like that (unfortunately there is very little official documentation on those, as far as I'm personally aware).

Using that output as a command phrase would require wildcards, which are noted to be a somewhat unsupported feature.

Part of the reason for that would be that the dictation output from the speech recognition system (which is what must be relied on when not using predefined phrases, which is the case with wildcards), even if it recognizes what you're saying perfectly, isn't necessarily consistent.
E.G. in this case (assuming the US English engine), "three minutes four seconds" will be transcribed as "00:03:04", but "three minutes" will instead be transcribed as "3 minutes", whereas "three minutes zero seconds" is, rather oddly, transcribed as "3 minutes zero secs"


To parse the output in a hh:mm:ss pattern, specifically, you could use the {TXTSUBSTR:} token, to retrieve the relevant sets of digits (simplest method for removing the leading zeroes, should you need to, may be to just convert them to integer values).


With a predefined command like the one in your example, it's worth evaluating how much precision is actually required.
E.G. "Timer [0..60] minutes [0..12,5] seconds" generates 793 permutations, while "Timer [0..60] minutes [0..6,10] seconds" generates 427

Boston

  • Newbie
  • *
  • Posts: 18
Re: I was playing with CMDSEGMENT to create a timer and this happened...
« Reply #2 on: February 20, 2023, 06:38:24 PM »
Thank you Pfeil,


I did read in the PDF the unsupported aspect of wildcards.  And you are right about different translations besides HH:MM:SS. I thought I could test for each type and convert it to an integer based on colons or text like "minutes".

Reducing permutations is a good idea. Maybe [0..10] minutes and [0;15;30;45] seconds. If I can't get the more intuitive approach to work.

I will dive deeper into {TXTSUBSTR:}.

BTW If you fly MSFS I have two commands and a text file that just tested out, that you will like :)