Author Topic: {CMDSEGMENT} Token comes up as 'Not Set'  (Read 6413 times)

mikelimtw

  • Jr. Member
  • **
  • Posts: 51
{CMDSEGMENT} Token comes up as 'Not Set'
« on: March 13, 2017, 05:07:57 AM »
I built a simple one line command to test the {CMDSEGMENT} token. The voice command is 'this is a test'

Say, 'Command segment 0 equals {CMDSEGMENT:0}'  (and wait until it completes)

I should get 'this' but instead VA says that {CMDSEGMENT:0} equals 'Not Set'. Also, the 'segment' argument must always be an integer or can the {CMDSEGMENT} token also evaluate literals such as:

{CMDSEGMENT:"{SMALL:Counter}"}

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2831
Re: {CMDSEGMENT} Token comes up as 'Not Set'
« Reply #1 on: March 13, 2017, 10:20:33 AM »
This is not a dynamic command, so there is no processing for command segments.  Dynamic commands contain square brackets [ ] within the, 'when i say' box.  [This][is][a][test] would have four segments, 0-3, but isn't very practical ;)

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4778
  • RTFM
Re: {CMDSEGMENT} Token comes up as 'Not Set'
« Reply #2 on: March 13, 2017, 10:36:45 AM »
[This][is][a][test] would have four segments, 0-3, but isn't very practical ;)
As it seems relevant, I'll make a cheeky reference to my feature request for String.Split() in a token, as that appears to be what the OP is looking for :P

the 'segment' argument must always be an integer or can the {CMDSEGMENT} token also evaluate literals such as:

{CMDSEGMENT:"{SMALL:Counter}"}
The double quotes to indicate a literal value are only necessary for commands that would otherwise expect a variable name. As the "{CMDSEGMENT:}" token does not, you can leave them out:
Code: [Select]
{CMDSEGMENT:{SMALL:Counter}}

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2831
Re: {CMDSEGMENT} Token comes up as 'Not Set'
« Reply #3 on: March 13, 2017, 01:46:28 PM »
I have that down to add (string split)... it will require UI, though.
« Last Edit: March 13, 2017, 01:56:32 PM by Gary »

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4778
  • RTFM
Re: {CMDSEGMENT} Token comes up as 'Not Set'
« Reply #4 on: March 13, 2017, 01:58:49 PM »
it will require UI
Could you elaborate on that? Would it be part of implementing some type of array functionality?

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2831
Re: {CMDSEGMENT} Token comes up as 'Not Set'
« Reply #5 on: March 13, 2017, 02:13:35 PM »
No... I'm thinking it would stuff values into variables named myVariable0, myVariable1, myVariable2, etc.

mikelimtw

  • Jr. Member
  • **
  • Posts: 51
Re: {CMDSEGMENT} Token comes up as 'Not Set'
« Reply #6 on: March 14, 2017, 02:06:09 AM »
Hi Gary/Pfeil,

Thanks for the replies but they don't answer my question. I set up a test command because I was always getting 'Not Set' using the {CMDSEGMENT} token. In my example above, {CMDSEGMENT:0} should return 'this' but instead it is returning 'Not Set'. In fact, all the segments are returning 'Not Set'.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4778
  • RTFM
Re: {CMDSEGMENT} Token comes up as 'Not Set'
« Reply #7 on: March 14, 2017, 06:18:49 AM »
In my example above, {CMDSEGMENT:0} should return 'this' but instead it is returning 'Not Set'. In fact, all the segments are returning 'Not Set'.
As Gary pointed out, your command does not contain any dynamic sections, so it has nothing to split.

"{CMDSEGMENT:}" does not split between words, but between those dynamic sections.

E.G. This command is [dynamic;] would make "{CMDSEGMENT:0}" return "This command is", and "{CMDSEGMENT:1}" either "dynamic" or "", depending on whether "This command is dynamic" or "This command is" were spoken, respectively.

mikelimtw

  • Jr. Member
  • **
  • Posts: 51
Re: {CMDSEGMENT} Token comes up as 'Not Set'
« Reply #8 on: March 15, 2017, 12:15:19 AM »
Hi Pfeil,

Ok I didn't understand Gary's answer. Your answer with the example cleared this up for me. Thanks!