Author Topic: use token in 'when I say' command  (Read 1958 times)

ctrlaltdelight

  • Newbie
  • *
  • Posts: 1
use token in 'when I say' command
« on: January 30, 2025, 08:02:11 AM »
I am trying to dynamically trigger an action by using one command to store a text variable, and using its token in another command's 'when I say' condition.

The text variable is stored correctly which I can verify by simply opening the text file on the file system, and I have set up another command to test what voice attack thinks the text variable is set to. I ask what the variable is, and it says the text to me with text-to-speech.

However, it does not trigger the command when I speak that word. I have found that if I go into that command and change something and save it, it then works and will trigger the action when I speak the word. Am I missing something on how tokens/variables work? Do I need to trigger some kind of refresh in the action of the command that sets the variable? I have checked, 'save value to profile' in the action that sets the variable.

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2881
Re: use token in 'when I say' command
« Reply #1 on: January 30, 2025, 10:48:38 AM »
Commands triggered with 'When I say' are established when the profile is loaded/reloaded, as that is the time when the speech engine is established.  The speech engine is not not dynamically updated when variables are changed, as that could be problematic.  You will need to have an action that reloads the profile (or reloads speech recognition - cant remember which - I'm away from my PC - I would try reloading speech recognition first) when you update the single variable.

You might also look at the 'Get User Input - Wait for spoken response' action - that will dynamically update when run.  Not sure if that would fit your need, but I wanted to at least mention it.