Author Topic: Token in Spoken Command?  (Read 867 times)

elbeau

  • Newbie
  • *
  • Posts: 2
Token in Spoken Command?
« on: December 22, 2022, 08:13:30 AM »
I'd like to create a text variable (or something) to shorten the following "When I say" entry
from
[show;switch to;run;open;launch;go to] Outlook
to
{TXT:VATriggerWords} Outlook

I've read documentation that some variables are not allowed in the section, but wasn't sure if that was the case here.
Hardcoding those VATriggerWords into their own variable/token would make maintaining the code much easier.

If it can be done, please explain it to me like I'm a 5th grader. :)


Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4781
  • RTFM
Re: Token in Spoken Command?
« Reply #1 on: December 22, 2022, 02:46:28 PM »
That is possible, though it is an undocumented advanced feature.

Main limitation is that the profile needs to be reloaded (E.G. using the "Reset the Active Profile" action) to re-parse the variable values (normally including when the profile is loaded initially, as the command list is compiled before the variables values will have been assigned).
I.E. if the variable value changes, that change will not affect the command phrase(s) until the profile is reloaded.


You'll need to have a good general understanding of variables and tokens. This topic may be of use, in addition to the official documentation:
Variables and tokens summed up



That said, if what you're looking for is to simplify editing those prefixes for multiple nearly identical commands for different applications, a simpler option could be to use prefix/suffix pairs.

A single prefix command can be used with multiple suffix commands, so you can have those dynamic command sections for the prefix command, which doesn't need to contain any actions, and use suffix commands with the name of the application you're looking to affect, which would contain the actions to perform that task.

elbeau

  • Newbie
  • *
  • Posts: 2
Re: Token in Spoken Command?
« Reply #2 on: December 23, 2022, 11:47:09 AM »
Thank you for your reply. Before I posted I'd read about & tried the undocumented solution and gave up.
While I knew about the prefixes/suffixes, I thought the undocumented solution might be better.
After reading your post I decided to give the latter a try & it works just fine - thank you for your help.