Author Topic: Not random variables for semicolons  (Read 1064 times)

E_RAMEL

  • Newbie
  • *
  • Posts: 37
  • 😊 VoiceAttack saves my wrists 👍🏻
    • Landscop design - Paysagistes
Not random variables for semicolons
« on: September 24, 2020, 08:39:10 AM »
Hello,
I want to use a copied text in any application and do pronounce by speech synthesis.
I managed well with a combination of keys "Ctrl + C" and then "Say" {clip}.
The problem is that when I semicolons in my copied text, "Say" identifies these as parts of random texts.
Would you have a solution that does not read the semicolons that way, or else remove the semicolons copied text to the clipboard?
I have not found it in the manual or the forums ...
Thank you in advance for your help.
Edgar

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Not random variables for semicolons
« Reply #1 on: September 24, 2020, 08:45:17 AM »
You can use the "{TXTREPLACEVAR:}" token to replace the semicolon character, either with another character or nothing (effectively removing it), E.G.
Code: [Select]
{TXTREPLACEVAR:"{CLIP}":";":","}
(note that the action list entry for the "Say Something with Text-To-Speech" action still interprets the semicolon as a delimiter, as it doesn't first parse the token)

E_RAMEL

  • Newbie
  • *
  • Posts: 37
  • 😊 VoiceAttack saves my wrists 👍🏻
    • Landscop design - Paysagistes
Re: Not random variables for semicolons
« Reply #2 on: September 24, 2020, 09:06:07 AM »
Hello Pfeil,
Thank you for the quick response, that is what I was looking for as the principle solution 👍🏻
I tried the syntax {TXTREPLACEVAR "CLIP {}" ";": ""}, but I have a return "Error in token".
I tried with {say} and {quick input}, same result.
Any idea what this is caused?
Thank you in advance.
Edgar

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Not random variables for semicolons
« Reply #3 on: September 24, 2020, 09:08:13 AM »
The correct syntax is in my previous post...

E_RAMEL

  • Newbie
  • *
  • Posts: 37
  • 😊 VoiceAttack saves my wrists 👍🏻
    • Landscop design - Paysagistes
Re: Not random variables for semicolons
« Reply #4 on: September 24, 2020, 09:20:08 AM »
Oops, error copy / paste 😵
Everything works well like that!
Excuse the newbies 😶
Again, thank you very much!

E_RAMEL

  • Newbie
  • *
  • Posts: 37
  • 😊 VoiceAttack saves my wrists 👍🏻
    • Landscop design - Paysagistes
Re: Not random variables for semicolons
« Reply #5 on: September 24, 2020, 12:14:23 PM »
The correct syntax is in my previous post...

Hello again,
I think I understand why I had this error "Error in token".
The syntax is correct, it works well with semicolons ";", but causes this error with colon ":".
Here I do not see the problem...

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Not random variables for semicolons
« Reply #6 on: September 24, 2020, 12:19:35 PM »
Colon is a reserved character within tokens (it's used as a separator between parameters).

If you want to replace text that uses reserved characters, you can use the "Replace" option of the "Set a Text Value" action, E.G.
Code: [Select]
Set text [~textToSpeak] to '{CLIP}' (Replace ':' with '')
Say, '{TXT:~textToSpeak}'

E_RAMEL

  • Newbie
  • *
  • Posts: 37
  • 😊 VoiceAttack saves my wrists 👍🏻
    • Landscop design - Paysagistes
Re: Not random variables for semicolons
« Reply #7 on: September 24, 2020, 01:16:54 PM »
🤗 Et VoilĂ  ! It works!
With two cascaded variable, it works perfectly 😀
Thank you for your support Pfeil 👏🏻

Code: [Select]
Press Left Ctrl+C keys and hold for 0.8 seconds and release
Set text [~TexteCopier] to '{CLIP}' (Replace ':' with '.')
Set text [~TextToSpeak] to [~TexteCopier] (Replace ';' with ',')
Say, ''{TXT:~TextToSpeak}''

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Not random variables for semicolons
« Reply #8 on: September 24, 2020, 09:53:18 PM »
You don't need two separate variables, FYI
E.G.
Code: [Select]
Set text [~textToSpeak] to '{CLIP}' (Replace ':' with '.')
Set text [~textToSpeak] to [~textToSpeak] (Replace ';' with ',')
will also work (put the variable name into the "A variable" field for the second action).

E_RAMEL

  • Newbie
  • *
  • Posts: 37
  • 😊 VoiceAttack saves my wrists 👍🏻
    • Landscop design - Paysagistes
Re: Not random variables for semicolons
« Reply #9 on: September 25, 2020, 12:20:12 AM »
Hello Pfeil,
Oh yes, it's cleaner that way!
My programming skills are fairly basic and it's nice of you to help newbies to use this wonderful software VoiceAttack 👏🏻
Good day or night to you.
Edgar