KnowBrainer Speech Recognition
Decrease font size
Increase font size
Topic Title: Window-specific commands
Topic Summary: what if the window title changes
Created On: 07/16/2012 10:13 AM
Status: Post and Reply
Linear : Threading : Single : Branch
 Window-specific commands   - Stephan Kuepper - 07/16/2012 10:13 AM  
 Window-specific commands   - Lunis Orcutt - 07/16/2012 07:05 PM  
 Window-specific commands   - Stephan Kuepper - 07/17/2012 03:07 AM  
 Window-specific commands   - Vincent - 07/17/2012 05:47 AM  
 Window-specific commands   - Stephan Kuepper - 07/17/2012 10:25 AM  
 Window-specific commands   - Vincent - 07/18/2012 04:22 AM  
 Window-specific commands   - monkey8 - 07/18/2012 09:01 AM  
 Window-specific commands   - Stephan Kuepper - 07/18/2012 09:53 AM  
Keyword
 07/16/2012 10:13 AM
User is offline View Users Profile Print this message

Author Icon
Stephan Kuepper
Top-Tier Member

Posts: 468
Joined: 10/04/2006

Hi all,

I have issues with the "transfer text" command that copies the text from the dictation box into an application. For some applications, the dictation box is not the best solution. Instead, dictation is done into DragonPad or WordPad or MS Word, to be copied into the target application.

To this end I created a new global command "transfer text", which works wonderfully in all applications - including the dictation box. This means that the native "transfer text" command is superseded by my own command.

I then created a new window-specific command "transfer text" that simply clicks the "Transfer" button, but no joy. After some testing, I found out why: the dictation box title always contains the window it is attached to; right now, for example, "Dictation Box (Posting a message - Mozilla Firefox)". As long as I make the command specific to this particular window, all is well. When I shorten the window title to "Dictation box", the global command again takes priority.

Obviously, I can't make window-specific commands for all conceivable applications, so if you have any ideas, please do let me know.

I should add that making my own "Transfer text" command specific to the word processor would work, but I would lose the ability to click into the/any target application and say "transfer text". Come to think of it, I might just rename that command "fetch text" - but that still doesn't solve the issue how to make a window-specific command less window-specific.

Hope I made myself clear,

Best, Stephan



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

www.egs-vertrieb.de - Speech Recognition Blog - Forum: www.immer-eine-Nuance-besser.de

 07/16/2012 07:05 PM
User is offline View Users Profile Print this message

Author Icon
Lunis Orcutt
Top-Tier Member

Posts: 22587
Joined: 10/01/2006

We are not certain what advantage an application-specific or Windows specific command would be in copying/cutting text from 1 application to another but in KnowBrainer 2011, we used a slightly different approach which you may find interesting. Because of some stability issues with the Dictation Box, we substituted NotePad. We use Transfer to cut all of the text from NotePad to the clipboard, close Notepad (which like the Dictation Box, closes without a prompt), drops the text and the previous application, presses {Tab} to move to the next field (assuming a next field is present) and re-launches NotePad. We use Transfer Out to perform the same function without reopening NotePad.

When we want to copy or cut text from 1 popular application to another, we simply call up that application. Some variations of that command include <Cut, Cut All, Copy, Copy All> to <Other Window, Word, Internet Explorer, Excel, Outlook>. This type of command allows us to target a specific application. For example, if we wanted to copy an entire webpage without any HTML coding, we could say Copy All to NotePad.



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


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


 


 


 



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

Author Icon
Stephan Kuepper
Top-Tier Member

Posts: 468
Joined: 10/04/2006

Lunis,

Thank you for your reply. Actually, I got my idea from you in the first place :-) Closing and re-opening NotePad is a good idea, I missed that one.

However this may be, in this particular instance I need formatted text, not just plain text. Therefore I need an editor which supports as much formatting as possible. DragonPad doesn't have enough; WordPad for Windows 7 is the minimum (plus it's available on every Windows computer).

One solution would be:
1. a WordPad-specific command that copies all text to the clipboard, closes WordPad, and transfers the contents of the clipboard into the target application (on a remote computer, incidentally, which poses extra challenges)
2. the same for MS Word
3. a global "Fetch dictation" command that switches the focus to WordPad/Word, copies all text, sitches back to the target application and pastes the text there.
4. the native "Transfer text" command for the dictation box.

Maybe I'm just too demanding when I want all command expressios to be the same? I don't like to remember too many commands, especially when they basically all do the same thing.

Anyway, to rephrase my initial problem: How can I teach Dragon that when I make a window-specific command for the dictation box, it recognizes the dictation box regardless of the actual title?

Stephan

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

www.egs-vertrieb.de - Speech Recognition Blog - Forum: www.immer-eine-Nuance-besser.de

 07/17/2012 05:47 AM
User is offline View Users Profile Print this message


Vincent
New Member

Posts: 7
Joined: 10/13/2006

Hallo Stephan,

you don't need the exact title to declare the command's availability window-specific. E.g., may be the full title "Diktierfenster (KnowBrainer Speech Recognition Forums - Window-specific commands - Mozilla Firefox)", then

"Diktierfenster (KnowBrainer Speech Recognition Forums - Mozilla Firefox)" or
"Diktierfenster (Window-specific commands - Mozilla Firefox)"

works too.

But "Diktierfenster (KnowBrainer - Window-specific commands - Mozilla Firefox)" doesn't work.

Vincent

 

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

Author Icon
Stephan Kuepper
Top-Tier Member

Posts: 468
Joined: 10/04/2006

Vincent,

that's what I thought, but in this case it didn't work. At least, "Diktierfenster" isn't enough. I can't make window-specific commands for "Diktierfenster - Mozilla Firefox", Diktierfenster - Opera", Diktierfenster - Schießmichtot", though.

I'll have to think about a "fetch dictation" command, then, or find another way to tweak the grammar.

Best wishes, Stephan

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

www.egs-vertrieb.de - Speech Recognition Blog - Forum: www.immer-eine-Nuance-besser.de

 07/18/2012 04:22 AM
User is offline View Users Profile Print this message


Vincent
New Member

Posts: 7
Joined: 10/13/2006

Stephan,

another idea: create a global scripting command, which - as first action - extracts the window title. Then decide by your own code what to do.

Vincent
 07/18/2012 09:01 AM
User is offline View Users Profile Print this message

Author Icon
monkey8
Top-Tier Member

Posts: 1987
Joined: 01/14/2008

Stephan,

 

Window specific commands are full window title specific and not part window title specific. Therefore if you want to do it with the window title then just check if the window title contains "Dictation Box" or the German equivalent. However a much better way of doing it (if I understand you correctly) is just to have one global "Transfer Text" command which checks if the dictation box is the active window, if it is the active window then it just clicks the "Transfer" button and if it isn't it runs your script.

 

Declare Function FindWindow Lib "user32" Alias _
"FindWindowA" (ByVal lpClassName As String, ByVal _
lpWindowName As Long) As Long
Declare Function GetForegroundWindow Lib "user32" () As Long
Sub Main
  'If the active window is the dictation box then just click the transfer text button
  If GetForegroundWindow = FindWindow ("DgnDictationBoxCls", 0) Then
     'Click the Transfer Text button
     SendKeys"%t"
  Else
     'If it is DragonPad or any other window enter your transfer text script here
  End If
End Sub

 

Just paste the above script into an advanced script command, make sure you use the FindWindow function as I have declared it as it is slightly mutated from the normal declaration.

Lindsay



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


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



 07/18/2012 09:53 AM
User is offline View Users Profile Print this message

Author Icon
Stephan Kuepper
Top-Tier Member

Posts: 468
Joined: 10/04/2006

Lindsay,

thank you so much for your elegant solution. Following Vincent's advice, I tried the same and have just finished and tested my script (which uses bits from Larry Allen and Alan Cantor). However, compared to yours, it's quite clumsy, so I replaced it with yours.

Kudos to all of you for your help, much appreciated!

(And now I'll have to find out how to put in a blank when the text from the dictation box does not end with a new paragraph :-)

Stephan



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

www.egs-vertrieb.de - Speech Recognition Blog - Forum: www.immer-eine-Nuance-besser.de

KnowBrainer Speech Recognition » NaturallySpeaking Speech Recognition » Window-specific commands

Statistics
27361 users are registered to the KnowBrainer Speech Recognition forum.
There are currently 2 users logged in.
The most users ever online was 2028 on 04/05/2013 at 07:36 PM.
There are currently 133 guests browsing this forum, which makes a total of 135 users using this forum.

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