0

I wrote the following voice command in Dragon NaturallySpeaking's advanced scripting:

Sub Main
    SendKeys"number_of_"
    Wait(0.2)
    HeardWord "no", "space"
End Sub

The point of the command is to type number_of_, then prevent Dragon from adding a space when the user dictate another word. As a result, I used HeardWord to call the no space voice command.

Everything works as expected except the line HeardWord "no", "space", which fails to call the no space voice command. Why?

Franck Dernoncourt
  • 77,520
  • 72
  • 342
  • 501

1 Answers1

0

When using HeardWord, you need to write the exact name of the command, and not some homonym. In this example, the exact name of the command is No-Space, and subsequently you should write:

Sub Main
    SendKeys"number_of_"
    Wait(0.2)
    HeardWord "No-Space"
End Sub
Franck Dernoncourt
  • 77,520
  • 72
  • 342
  • 501
  • 1
    What version of Dragon do you use? I use DNS13 and the vocabulary entry for `underscore` (`_`) is already set to have no space preceding and following. So after the `SendKeys"number_of_"` line, without the next 2 lines, I get the next word being added with no preceding space. In general, I think this kind of thing is better handled with the vocabulary editor, anyway. So you could have a word with a spoken form of `special variable` with a written form of `numberof` and set the properties to have no following space and the next utterance will be added without the space `numberofthings`. – PGilm Jul 26 '16 at 14:07
  • @PGilm thanks, good catch, I should indeed use this property of having no following space. (I use Dragon NaturallySpeaking 12.5 pro). However, if I use a command, I do seem to need to add `HeardWord "No-Space"` otherwise it adds a space :/ – Franck Dernoncourt Jul 26 '16 at 14:13