KnowBrainer Speech Recognition
Decrease font size
Increase font size
Topic Title: Auto numbering websites using Dragon States
Topic Summary: Using SetState to keep track of what is being numbered
Created On: 09/16/2020 11:24 PM
Status: Post and Reply
Linear : Threading : Single : Branch
 Auto numbering websites using Dragon States   - PG LTU - 09/16/2020 11:24 PM  
 Auto numbering websites using Dragon States   - Alan Cantor - 09/17/2020 12:07 AM  
 Auto numbering websites using Dragon States   - PG LTU - 09/17/2020 12:45 AM  
 Auto numbering websites using Dragon States   - Mav - 09/17/2020 03:12 AM  
Keyword
 09/16/2020 11:24 PM
User is offline View Users Profile Print this message

Author Icon
PG LTU
Top-Tier Member

Posts: 2072
Joined: 03/21/2007

Thanks to a paricular odd suggestion by Mav about using States to store information got me thinking.  Here to show the potential is a set of browser "numbering" commands that use State to keep track of what is being numbered. 

 

So the application-specific command (for edge or chrome, etc or one app-specific commands for each) is "Pick [browsercontrol]" and it numbers all the matching browser elements from this list:

 

Button

Check

Check Box

Edit

Edit Box

Image

Link

Radio

Radio Button

Text

Text Field

 

 

and it sets the State to that element type.

 

Here is the command:

 

Sub Main

    If GetState <> "" Then Wait 2.5
    EngineControl.RecognitionMimic("click " & LCase(ListVar1))
    SetState Left(ListVar1, InStr(ListVar1 & " ", " ") -1)
End Sub

 

 

Now the fun part.  The application-specific command to choose the number is "Pick [1to200]" but you have to also add the following States as well: 

 

Button, Check, Edit, Image, Link, Radio, and Text

 

and the command will click the numbered element and go to the new page and then renumber all the elements on the new page (by seeing what the state is that the earlier commnd set).  Here's that command:

 

Sub Main

    EngineControl.RecognitionMimic("choose " & Left(ListVar1, InStr(ListVar1 & "\","\")-1))
    EngineControl.RecognitionMimic("pick " & GetState)
End Sub

 

 

Lemme know if you try it...



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




PG





Remember folks, my comments and this forum are for entertainment value only, please, no wagering or other reliance on the contents herein.  I permit no commercial use of my ideas (whether expressions or embodiments) without my written consent.



 09/17/2020 12:07 AM
User is offline View Users Profile Print this message


Alan Cantor
Top-Tier Member

Posts: 3841
Joined: 12/08/2007

The recent mention of states got me wondering, and a few days ago, I sort-of figured out how to take advantage of states.

The first command provides an easier way to navigate in drop-down lists within Word documents. These drop downs are not particularly Dragon friendly. This command sets a state.

The second command is only recognized when the state has been set by the first command. The name of the second command is "OK". The command accepts the selected item on the drop-down, navigates to the next drop-down list, and then opens another drop-down list. When this command runs, the state is turned off.

This means "OK" is recognized as a command in drop-down lists in Microsoft Word documents, but as a regular word in a Word document.

Command: Jump To <1-5>

Sub Main

' Do something

SetState "drop-down-focused"
End Sub

Command: OK
[Recognizable in State drop-down-focused]

Sub Main
SendKeys "{Enter}"
SendKeys "{Tab}", True
SendSystemKeys "{Alt+Down}"

SetState ""

End Sub
 09/17/2020 12:45 AM
User is offline View Users Profile Print this message

Author Icon
PG LTU
Top-Tier Member

Posts: 2072
Joined: 03/21/2007

Cool. If you really want to learn states, check out the Sample structured state commands and compare the WordPad to the Dragon Pad approaches.

My commands are not about that, so much as using the name of the state as info to be used in the command - essentially storing info about the type of element to be numbered by some later-called subsequent command.

My first command both numbers the particular browser elements, and sets one of the six states depending on the list (and particularly the first word of the list element). And the second command works *Only* if one of those six states are indeed active; and if so, "chooses" the numbered element (by looking at the [1to200] list, which can be normal or complex or a mix of both), effectively clicking on it to bring up a new page (or focus on an element), and then calls that first numbering command again using the State that was set as the [browsercontrol] list result so the same element types are numbered on the new page.

 

Note, this is all Dragon's built-in numbering and no fancy add-ons required - I can even do it at work!

Have fun.



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




PG





Remember folks, my comments and this forum are for entertainment value only, please, no wagering or other reliance on the contents herein.  I permit no commercial use of my ideas (whether expressions or embodiments) without my written consent.



 09/17/2020 03:12 AM
User is offline View Users Profile Print this message

Author Icon
Mav
Advanced Member

Posts: 194
Joined: 10/02/2008

Cool!

I've looked at the state sample commands and also found that you can only SetState for states which have be defined in voice commands outside the script, defying the idea to use dynamic values for states.

Did you find a way to create a voice command from within a script that's bound to a certain state?

 

mav

Statistics
31783 users are registered to the KnowBrainer Speech Recognition forum.
There are currently 1 users logged in.
The most users ever online was 12124 on 09/09/2020 at 04:59 AM.
There are currently 969 guests browsing this forum, which makes a total of 970 users using this forum.

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