KnowBrainer Speech Recognition
Decrease font size
Increase font size
Topic Title: Call Another Script
Topic Summary: Using HeardWord to Call a Script
Created On: 03/30/2012 02:29 PM
Status: Post and Reply
Linear : Threading : Single : Branch
 Call Another Script   - Mark01 - 03/30/2012 02:29 PM  
 Call Another Script   - monkey8 - 03/30/2012 02:39 PM  
 Call Another Script   - Mark01 - 03/30/2012 05:41 PM  
 Call Another Script   - Lunis Orcutt - 03/30/2012 03:58 PM  
 Call Another Script   - mhaines94108 - 07/02/2012 06:20 AM  
 Call Another Script   - Lunis Orcutt - 07/02/2012 02:43 PM  
 Call Another Script   - mhaines94108 - 07/03/2012 06:44 AM  
 Call Another Script   - Chucker - 07/03/2012 07:10 AM  
 Call Another Script   - mhaines94108 - 07/04/2012 02:55 AM  
 Call Another Script   - monkey8 - 07/04/2012 06:33 PM  
 Call Another Script   - Chucker - 07/04/2012 06:57 PM  
 Call Another Script   - monkey8 - 07/04/2012 07:06 PM  
 Call Another Script   - mhaines94108 - 07/14/2012 10:30 AM  
 Call Another Script   - mhaines94108 - 07/14/2012 10:39 AM  
Keyword
 03/30/2012 02:29 PM
User is offline View Users Profile Print this message


Mark01
Junior Member

Posts: 7
Joined: 07/29/2010

I'm using HeardWord to call a script from another script using DNS Pro 11.5. The problem is that it is unreliable. I tried using Dgnengine.RecognitionMimic, but nothing happens when the command is executed. Is there a reliable way to call a script from another script?

-------------------------
DNS Pro 11.5; Win 7; i7 930 2.80 GHz, 8g RAM
 03/30/2012 02:39 PM
User is offline View Users Profile Print this message

Author Icon
monkey8
Top-Tier Member

Posts: 2408
Joined: 01/14/2008

If recognition mimic is doing nothing then you probably have the wrong syntax or declaration, as an example it should be as below. Please note that "Action Centre" is the name of the command and you do not separate the words like you do with HeardWord. The problem with both methods is that they are very slow and if possible you should try and incorporate the code of the other script you are calling directly, I know it's more work but it's much quicker.

Sub Main
 Dim engCtrl As New DgnEngineControl
 engCtrl.Register
 engCtrl.RecognitionMimic ("Action Centre" )
End Sub

Lindsay

-------------------------


www.pcbyvoice.com
www.pcbyvoice.co.uk

 03/30/2012 05:41 PM
User is offline View Users Profile Print this message


Mark01
Junior Member

Posts: 7
Joined: 07/29/2010


Hi Lindsay and Lunis,

I found the error; there was no space after Mimic:
Dgnengine.RecognitionMimic("test 2"



-------------------------
DNS Pro 11.5; Win 7; i7 930 2.80 GHz, 8g RAM
 03/30/2012 03:58 PM
User is offline View Users Profile Print this message

Author Icon
Lunis Orcutt
Top-Tier Member

Posts: 25658
Joined: 10/01/2006

When using Pro 10, we experienced a lot of difficulties when attempting to use Advanced-Scripting commands to perform a HeardWord of other Advanced-Scripting commands and eventually gave up on the direct approach. Interestingly enough, HeardWord scripts to other types of commands, like Natural Language and boilerplate text, are not an issue. HOWEVER, strange as it may sound, if you create a legacy dvc Advanced-Scripting command to perform a HeardWord of another legacy or even a standard Advanced-Scripting command, it should work. KnowBrainer 2011, which doesn't have this problem, additionally includes a blank legacy command that can be imported into DNS Pro when you say Import KnowBrainer Commands but if all you need is a blank legacy dvc command and you know how to create dvc commands, just import the Blank dvc.dat command that is attached to this post.




-------------------------


Click KB 2012 REV D to Download a 30 Day Evaluation of KnowBrainer 2012
Click SpeechStart+ to Download a 15 Day Evaluation of SpeechStart+

 07/02/2012 06:20 AM
User is offline View Users Profile Print this message


mhaines94108
Junior Member

Posts: 39
Joined: 12/06/2010

I am having a potentially similar problem. I would like to automate signing out of Gmail. To do this I need to click on the link with the text "Sign out". Neither of these commands is working for me.

MsgBox "Trying with Recognition Mimic"
Dim engCtrl As New DgnEngineControl
engCtrl.Register
engCtrl.RecognitionMimic ("Click Sign Out")

MsgBox "Trying with HeardWord"
HeardWord "Click", "Sign", "Out"
 07/02/2012 02:43 PM
User is offline View Users Profile Print this message

Author Icon
Lunis Orcutt
Top-Tier Member

Posts: 25658
Joined: 10/01/2006

Try HeardWord "click", "Sign", "out" or HeardWord "click", "sign", "out". Note the case change.



-------------------------


Click KB 2012 REV D to Download a 30 Day Evaluation of KnowBrainer 2012
Click SpeechStart+ to Download a 15 Day Evaluation of SpeechStart+



 07/03/2012 06:44 AM
User is offline View Users Profile Print this message


mhaines94108
Junior Member

Posts: 39
Joined: 12/06/2010

The second variation, with all words in lowercase, worked. This is despite the fact that the link is "Sign out".

 07/03/2012 07:10 AM
User is offline View Users Profile Print this message

Author Icon
Chucker
Top-Tier Member

Posts: 11166
Joined: 10/10/2006

Originally posted by: mhaines94108 The second variation, with all words in lowercase, worked. This is despite the fact that the link is "Sign out".


Matthew,


Good learning experience. As far back as the first version of DNS that allowed scripting using the HeardWord command line, with very few exceptions, all the words in the HeardWord command line must be lowercase. In other words, with the exception of some of the Dictation commands (Vocabulary Editor), HeardWord only accepts lowercase. You should make a note of that and keep it somewhere. HeardWord was first introduced in DNS 6.0 and the syntax hasn't changed up to and including the current version.


Chuck


"If the automobile had followed the same development cycle as the computer, a Rolls-Royce would today cost $100, get a million miles per gallon, and explode once a year, killing everyone inside." -- Robert X. Cringely



-------------------------

 07/04/2012 02:55 AM
User is offline View Users Profile Print this message


mhaines94108
Junior Member

Posts: 39
Joined: 12/06/2010

I looked in the Dragon manual for the HeardWord command. It merely says that the command is case sensitive. Disappointing.

Why is it that the HeardWord variant would work when the RecognitionMimic variant does not? Where can I find documentation on RecognitionMimic?

Is it possible to use either HeardWord or RecognitionMimic with commands that have variables in the name? Are there limitations or gotchas with that? So far I have been unsuccessful in getting either to work with the command with a variable in the name.
 07/04/2012 06:33 PM
User is offline View Users Profile Print this message

Author Icon
monkey8
Top-Tier Member

Posts: 2408
Joined: 01/14/2008

1. First of all recognition mimic should work fine using the following script:

 

Sub Main
Dim engine As New DgnEngineControl
engine.Register
engine.RecognitionMimic "click sign out"
End Sub

 

2. Secondly the help file is correct in that in 99% of cases HeardWord is case sensitive, there are just a few anomalies with a couple of built-in commands. It is simply not true that you should always use lowercase with HeardWord.

 

3. Using HeardWord just calls RecognitionMimic. Note that RecognitionMimic does not have commas between the individual words in the command name but just spaces.

 

4. You can't always go by the case sensitivity shown by the text on a webpage, the API that Dragon utilises normally goes by the underlying name of the control which isn't always going to be what the text says.

 

5. There is a Dragon API/SDK help file with every Enterprise Installation of DNS (Professional, Medical & Legal), you will find information on RecognitionMimic in that file. Search for that method name using the index tab. Here is the screenprint from that file.

 

"C:\Program Files (x86)\Nuance\NaturallySpeaking11\Help\dnsapi.chm"

Incidentally if you want to know what the case should be then go buy exactly what the case is of each word in the results box when you at all the command.

 

 

Lindsay



-------------------------


www.pcbyvoice.com
www.pcbyvoice.co.uk



 07/04/2012 06:57 PM
User is offline View Users Profile Print this message

Author Icon
Chucker
Top-Tier Member

Posts: 11166
Joined: 10/10/2006

It is simply not true that you should always use lowercase with HeardWord.


Lindsay,

That's Not What I Said if you're referring to my post.

Chuck

I know that you believe you understand what you think I said, but, I am not sure you realize that what you heard is not what I meant.

-------------------------

 07/04/2012 07:06 PM
User is offline View Users Profile Print this message

Author Icon
monkey8
Top-Tier Member

Posts: 2408
Joined: 01/14/2008

Chuck,

What you said was:

with very few exceptions, all the words in the HeardWord command line must be lowercase. 


What does that mean then?

Lindsay



-------------------------


www.pcbyvoice.com
www.pcbyvoice.co.uk

 07/14/2012 10:30 AM
User is offline View Users Profile Print this message


mhaines94108
Junior Member

Posts: 39
Joined: 12/06/2010

An important point about RecognitionMimic is that the commands do not execute immediately at the point in which they appear in the script. Rather, it seems that Dragon cues them up and executes them only when the current script ends.

To test this hypothesis, I created the following program called "change mailbox to <mailboxlist>":

Sub Main

 Dim engCtrl As New DgnEngineControl
 engCtrl.Register

 HeardWord "script", "begins", "here"
 Wait 10.0
 engCtrl.RecognitionMimic("scroll up")
 Wait 10.0
 engCtrl.RecognitionMimic ("click sign out")
 Wait 10.0
 engCtrl.RecognitionMimic ("log on as " + ListVar1)
 Wait 10.0

End Sub

I then invoke the script by saying "Change mailbox to [mailbox]"

Looking then in the recognition history, I see the following entries:

18:51 – change mailbox to [mailbox]

18:52 – script begins here

19:33 – scroll up

19:34 – click sign out

19:34 – log on as [mailbox]

To me the conclusion is that RecognitionMimic will normally only be useful when it is the last command in the file. Certainly if you're going to exploit the queuing of commands until after the current script finishes, this would require an explicit comment in the code.



 07/14/2012 10:39 AM
User is offline View Users Profile Print this message


mhaines94108
Junior Member

Posts: 39
Joined: 12/06/2010

I should mention that HeardWord seems to execute the commands immediately, as if a subroutine had been called. That is, execution of the existing script waits until HeardWord returns. Also, in the above text the blank line between the two 19:34 entries is a mistake, but I don't know how to delete it.
Statistics
28461 users are registered to the KnowBrainer Speech Recognition forum.
There are currently 6 users logged in.
The most users ever online was 2028 on 04/05/2013 at 07:36 PM.
There are currently 117 guests browsing this forum, which makes a total of 123 users using this forum.

FuseTalk Standard Edition v4.0 - © 1999-2014 FuseTalk™ Inc. All rights reserved.