Author Topic: Unable to get TXTREPLACEVAR to work.  (Read 1054 times)

d3ck3r_x

  • Newbie
  • *
  • Posts: 4
Unable to get TXTREPLACEVAR to work.
« on: July 21, 2021, 10:31:57 AM »
I'm starting to try to write something more than just basic scripts and therefore am starting to familiarise myself with the concept of tokens. With this particular token I am struggling as my resulting log entry returns as "Not set." The spoken command is "this is a test," and I'm expecting the log entry to be "this is a monkey." What is it that I'm principally not understanding?

Code: [Select]
Set text [myVariable] to '{CMD}'
Set text [myVariable] to '{TXTREPLACEVAR:myVariable:”test”:”monkey”}'
Write [Blue] '{TXT:myVariable}' to log

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Unable to get TXTREPLACEVAR to work.
« Reply #1 on: July 22, 2021, 05:59:02 AM »
Have you copy/pasted the example from the documentation? What looks like double quotes are actually different characters, thanks to Microsoft Word replacing them with "smart" quotes (an option that the author has turned off a few times, but keeps coming back).

Replace the occurrences of ” (ASCII 8221) with " (ASCII 34)


As a side note, the command can be optimized:
If you actually need the variable,
Code: [Select]
Set text [myVariable] to '{TXTREPLACEVAR:"{CMD}":"test":"monkey"}'
Write [Blue] '{TXT:myVariable}' to log
or if you don't,
Code: [Select]
Write [Blue] '{TXTREPLACEVAR:"{CMD}":"test":"monkey"}' to log

d3ck3r_x

  • Newbie
  • *
  • Posts: 4
Re: Unable to get TXTREPLACEVAR to work.
« Reply #2 on: July 22, 2021, 09:52:42 AM »
Yes your right, I did copy/paste from the documentation. I was unaware of "smart" quotes. I did also manually enter as per the documentation using DragonSpeech as I'm unable to use a keyboard and that must also use "smart" quotes. A simple DragonSpeech vocabulary editor add has worked me around the problem.
Many thanks