Author Topic: Text to speach repeat  (Read 1207 times)

realsville

  • Newbie
  • *
  • Posts: 2
Text to speach repeat
« on: March 25, 2023, 11:06:40 AM »
Hi, sorry if this has been covered before but I have spent hours searching and cant find an answer.  I would like my text to speech phrase repeated for as long as the associated key in the command is pressed, and stopped when the key is released.  I don't want to repeat the whole command, (that caused me problems) just the text to speech part of the command.  Right now it works normally with the text to speech phrase playing once when the button is first pressed down.   Thank you.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Text to speach repeat
« Reply #1 on: March 25, 2023, 11:14:07 AM »
A "Loop Start" action can be used for this, E.G.
Code: [Select]
Start Loop While :  Keyboard Key 'A' Is Pressed
    Say, 'My text-to-speech phrase'  (and wait until it completes)
End Loop
However, as the loop is synchronous, your command would not proceed until you let go of the key.

If that is undesirable, you'd need to run the loop in a separate command, and start that command asynchronously from the first command (using the "Execute Another Command" action with the "Wait until this command completes before continuing" option unchecked).

realsville

  • Newbie
  • *
  • Posts: 2
Re: Text to speach repeat
« Reply #2 on: March 25, 2023, 12:04:57 PM »
worked perfect!  Thank you for your help!