KnowBrainer Speech Recognition
Decrease font size
Increase font size
Topic Title: Scripting of mouse movements and clicks
Topic Summary: Scripting of mouse movements and clicks
Created On: 03/01/2011 03:08 AM
Status: Post and Reply
Linear : Threading : Single : Branch
 Scripting of mouse movements and clicks   - csallada - 03/01/2011 03:08 AM  
 Scripting of mouse movements and clicks   - Chucker - 03/01/2011 10:24 AM  
 Scripting of mouse movements and clicks   - csallada - 03/13/2011 12:15 AM  
 Scripting of mouse movements and clicks   - Chucker - 03/13/2011 03:58 AM  
 Scripting of mouse movements and clicks   - Lunis Orcutt - 03/01/2011 04:26 PM  
 Scripting of mouse movements and clicks   - Allan - 03/02/2011 01:19 PM  
 Scripting of mouse movements and clicks   - monkey8 - 03/13/2011 10:20 AM  
 Scripting of mouse movements and clicks   - csallada - 03/13/2011 10:20 PM  
 Scripting of mouse movements and clicks   - monkey8 - 03/14/2011 05:24 AM  
 Scripting of mouse movements and clicks   - csallada - 03/14/2011 07:27 AM  
 Scripting of mouse movements and clicks   - monkey8 - 03/14/2011 07:53 AM  
 Scripting of mouse movements and clicks   - csallada - 04/10/2011 03:11 AM  
 Scripting of mouse movements and clicks   - monkey8 - 04/12/2011 12:35 PM  
 Scripting of mouse movements and clicks   - Lunis Orcutt - 04/12/2011 01:35 PM  
 Scripting of mouse movements and clicks   - gt1982 - 01/19/2012 05:18 PM  
 Scripting of mouse movements and clicks   - Chucker - 01/19/2012 07:03 PM  
 Scripting of mouse movements and clicks   - gt1982 - 01/19/2012 08:18 PM  
Keyword
 03/01/2011 03:08 AM
User is offline View Users Profile Print this message


csallada
New Member

Posts: 20
Joined: 02/10/2009

I use a practice management system called Genie. I have Dragon Medical 10.1 and knowbrainer software for commands. I use Dragon dictation to dictate my letters.

 

At the moment prior to dictating a letter i need to make a number of mouse clicks and movements. I have use a macro recording to record these movements to create a command however the problem is that this is relatively slow and does not work if i run the command on the different computer with a different screen size.

 

See the accompanying pictures: 

for example prior to dictating a letter i need to click on the quill icon, then click on the arrow need to the default letter, then choose new letter from the list, then click on the reviewed tab before pressing the microsoft icon button.

 

Ideally i would like to teach commands specific for the program so if doesn't matter which screen size the program is on.

 

the second option would be to create a script independent of the macro recorder that incorporate mouse click on certain parts of the screen.

 

chris allada



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

Christopher Allada

Cardiologist

Dragon Medical 11, Knowbrainer 2011, Dell Precision T3500 PC, Xeon W3520 CPU at 2.8GHz, Windows 7 Professional 64 bit, 12 GB ram

 03/01/2011 10:24 AM
User is offline View Users Profile Print this message

Author Icon
Chucker
Top-Tier Member

Posts: 9671
Joined: 10/10/2006

Chris,

Basically, you can write Advanced Scripting macros using mouse positioning commands. However, you're still going to be subject to problems associated with screen relocation. In other words, you may develop an advanced scripting macro that correctly positions the mouse when the screen is in a particular location. However, if the screen size changes or if the location changes, then your original mouse positioning commands will not go to the correct location. There may be others on this forum that have developed scripts that get around this problem, but I'll let them explain what they have done and how they have done it because I don't have a need for doing this. I use VoicePower which allows me to simply, within 10 seconds, change the position within a single Wizard driven command depending upon the screen location. With VoicePower I can also create multiple commands depending upon unique screen locations so that I can apply the appropriate one. It's much simpler than writing advanced scripts and editing them.

Unfortunately, you're several years behind in your version of DNS and VoicePower would not work for you anyway. The current version of VoicePower only works with DNS 10-10.1 and DNS 11. What I'm trying to say is that while there may be a solution, it will not be an easy one and it may require more effort than it's worth. However, I will leave that up to those who have more need for this type of mouse positioning and who may already have a working solution.

On the other hand a question for you is are the options that you want to select accessible by simply saying them. This is called say-what-you-see and is a function of Microsoft Active Accessibility, which is supported in DNS 8.1. It's not possible to tell by your application or your screen captures whether or not they are. Nevertheless, it's worth a try. Also, does the application in your screen captures support Select-and-Say? That is, when you're dictating into any text window, does the message on the DragonBar say "dictating to a nonstandard window" and are you able to select text anywhere in the visible portion of your document and selected for correction and/or read dictation?

Chuck Runquist
Technical Project Manager
VoiceTeach LLC
Home of VoicePower® Ultimate

"At times we shall simply have to admit that, one way or another, what we can neither explain nor understand certainly doesn't cease to exist because we cannot see how it does or why it should." - Dr. Mark Hyman



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

 03/13/2011 12:15 AM
User is offline View Users Profile Print this message


csallada
New Member

Posts: 20
Joined: 02/10/2009

Thankyou for you comments, Chuck and others. I have updated my profile as i am using Dragon Medical 10.1.

 

I was unable to locate the application VoicePower. Where can i get this?

 

I cannot use commands and dictate freely in Genie as i can say in word as in says "dictating to a nonstandard window". Other than the top commands eg file, edit, open etc which is in the top menu of Genie I cannot command any other parts of the program. Only 2 of the icons have a key command.

 

I am happy to use mouse position commands as i do most dictating from this computer. I am not sure however how i do a mouse position command. Does anyone have an example of a simple script that uses a combination of keystrokes and mouse clicks in different positions with slight pauses between each comman? Or does the VoicePower program do this? I am happy to give advanced scripting a go but again i am not sure where i access mouse grid or mouse position commands. As you can see below Genie has made a couple of the icons have keystokes but the remainder i need to use mouse clicks.

 

Therefore to write a letter:

Press Stethoscope symbol. There is a command- (CTRL-K)

Slight pause

Press Quill symbol. There is a command- (CTRL-R)

Slight pause

Press marked as reviewed box. There is a command- (CTRL-R)

Slight pause

Mouse click on arrow to the right of default letter

Slight pause

Mouse click on 'one of the letter templates'

Slight pause

Mouse click over word sign

 

Chris



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

Christopher Allada

Cardiologist

Dragon Medical 11, Knowbrainer 2011, Dell Precision T3500 PC, Xeon W3520 CPU at 2.8GHz, Windows 7 Professional 64 bit, 12 GB ram

 03/13/2011 03:58 AM
User is offline View Users Profile Print this message

Author Icon
Chucker
Top-Tier Member

Posts: 9671
Joined: 10/10/2006

Quote:
I was unable to locate the application VoicePower. Where can i get this?


Chris,

Go to the following link: VoicePower® Ultimate

Chuck Runquist
Technical Project Manager
VoiceTeach LLC
Home of VoicePower® Ultimate

"Always do right - this will gratify some and astonish the rest". -- Mark Twain



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

 03/01/2011 04:26 PM
User is offline View Users Profile Print this message

Author Icon
Lunis Orcutt
Top-Tier Member

Posts: 22636
Joined: 10/01/2006

We believe that Chuck's answer is partially aimed at your old profile and tag which both state that you're using DNS Pro 8 but we updated your profile to reflect that you are using Medical 10.1 since you mentioned it in your 1st paragraph. We don't have the ability to edit your tagline. This will give you additional options such as VoicePower.

We would strongly recommend against using Macro Recorder commands because they waste a lot of space in your Command Browser and because they recorded in real time. They also play back in real time which makes them appear lethargic. Mouse Position commands are somewhat risky because they tend to only work well on 1 monitor at 1 specific resolution and even then, things can change and you wind up having to rewrite your commands.

We minimally recommend creating step-by-step macros or if you're feeling a little braver, Advanced-Scripting commands. Although you can use either MouseGrid or Mouse Position commands in Advanced-Scripting, it's better if you can find workarounds such as activator keys or even pressing the {Tab} key multiple times. Try left-clicking into Heaolthscope app and pressing the {Alt} on your keyboard. If the developers of Healthscope did a decent job, you should see a activation keys which will typically look like a short line under one of the letters such as Add Consult, Edit Consult, Save etc… This will make your work easier.


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


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


 


 


 

 03/02/2011 01:19 PM
User is offline View Users Profile Print this message


Allan
Top-Tier Member

Posts: 329
Joined: 03/25/2008

I agree with Lunis about using activator keys in an Advanced Scripting Macro.  However, when stuck with mouse clicks, one needs to locate them for each compute/screen combination, and not change the screen layout.  Then using the following script, and substituting the ID of your particular computers, you can write one macro that does not need to be edited.

 

            If Environ ("computername" = "243-GC-023-1C" Then

                        Y_offset = 0

                        X_offset = 0

            ElseIf Environ ("computername" = "243-2B-440-2A" Then

                        Y_offset = 15

                        X_offsset = 5

            End If

 

SetMousePosition 1,628+ X_offsset,155 + Y_offset

 03/13/2011 10:20 AM
User is offline View Users Profile Print this message

Author Icon
monkey8
Top-Tier Member

Posts: 1990
Joined: 01/14/2008

Chris

I have attached several commands that will accomplish your tasks with advanced scripting. Simply import the XML file attached into your Command Browser and you will add to your repertoire 4 new voice commands, the first three will accomplish your tasks:

"add advanced scripting command"
"record mouse position"
"paste mouse position"

First of all call "add advanced scripting command" and this will create your empty advanced scripting command.

Then go to your application and make sure it is the active window, position the mouse exactly where you require and then call "record mouse position"

You will receive a verbal confirmation that the mouse position has been recorded and then you just simply move back to your advanced scripting command and call "paste mouse position", this will paste in the mouse position, a Wait line and a button click command into your new script/voice command. E.g.

SetMousePosition 1,222,314
Wait 0.1
ButtonClick 1,1

Then just repeat the process with as many steps as you require and finally give your new voice command/script a name. Once you have used the commands a few times you will be able to create multiple mouse position voice commands very quickly.

When you import the XML file it'll also import a voice command/script called "add mouse position command". Basically this command will create a complete script, for which you just need to add a name, but this will only record a single mouse position and then implement a left mouseclick for that position. It's very quick for creating single mouse position commands but for multiple mouse position commands you need to use the 3 commands above.

Lindsay
www.pcbyvoice.com

Edit: I just realised that the "add advanced scripting command" script that is in the multiple mouse positioning commands file will create global commands which will be recognised anywhere.  If you use the "add advanced scripting command" from the separate scripting command update file it'll create the commands so that they are only recognised when the relevant application is active.  If you just import this file last it'll give you the option to overwrite the existing "add advanced scripting command" and then use this. 






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


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

 03/13/2011 10:20 PM
User is offline View Users Profile Print this message


csallada
New Member

Posts: 20
Joined: 02/10/2009

Thankyou Linday for those commands. They seem to work fine. Is it possible to have a combination of mouse clicks and keyboard commands in the same script? i am not sure how to do this.

 

i have tried a combination of mouse clicks and keyboard commands which doesn't work:

Sub Main
SendKeys "{CTRL+k}"
Wait .5
SendKeys "{CTRL+r}"
Wait .9
SendKeys "{CTRL+r}"
Wait .5
SetMousePosition 1,465,90
ButtonClick
Wait .5
SetMousePosition 1,74,6
ButtonClick
Wait .5
SetMousePosition 1,73,136
ButtonClick
End Sub

if i replace the keyboard commands with their equivalent mouse clicks it works fine however.

Sub Main
SetMousePosition 1,145,439
ButtonClick
Wait .5
SetMousePosition 1,170,96
ButtonClick
Wait 1.1
SetMousePosition 1,465,90
ButtonClick
Wait .5
SetMousePosition 1,74,6
ButtonClick
Wait .5
SetMousePosition 1,681,93
ButtonClick
Wait .5
SetMousePosition 1,73,136
ButtonClick
End Sub

 

Chris



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

Christopher Allada

Cardiologist

Dragon Medical 11, Knowbrainer 2011, Dell Precision T3500 PC, Xeon W3520 CPU at 2.8GHz, Windows 7 Professional 64 bit, 12 GB ram

 03/14/2011 05:24 AM
User is offline View Users Profile Print this message

Author Icon
monkey8
Top-Tier Member

Posts: 1990
Joined: 01/14/2008

Yes you can combine mouse positions and keyboard shortcuts in the same command, however as an example:

SendKeys"{Ctrl+k}" will not work because they changed the syntax for this command.

You need to use either of the following:

SendDragonKeys"{Ctrl+k}"
SendKeys"^k"

if you use SendKeys then note the following key signatures:

^  = control key
% = alt key
+ = shift key

Lindsay
www.pcbyvoice.com



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


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

 03/14/2011 07:27 AM
User is offline View Users Profile Print this message


csallada
New Member

Posts: 20
Joined: 02/10/2009

Dear Lindsay,

 when i create the advanced script and run it nothing seems to happen. I have tried having a space after SendKeys and no space after SendKeys with the same result. again nothing happens if i use the SendDragonKeys"{Ctrl+k}" instead. if i manually press on the keyboard CTRL-K, short pause, CTRL-R, short pause, CTRL-R short pause it works however. The following is an example of the script where nothing seems to happen when i say the command.

Sub Main
SendKeys"^k"
Wait 1.5
SendKeys"^r"
Wait 1.5
SendKeys"^r"
Wait 1.5

End Sub

 I have also noted that nothing happens when i add into a script the mouse click as seen in the second picture where i have tried to click onto the sidebar to allow me to scroll as the page to another template as seen in the third picture. i am not sure why i cannot recreate the mouse click for this sidebar. When i try the script below everything works except for the last click as i stated in the previous sentence and therefore i cannot scroll up the template list.

Sub Main
SetMousePosition 1,144,437
Wait 2.5
ButtonClick
SetMousePosition 1,175,95
Wait 2.5
ButtonClick
SetMousePosition 1,677,92
Wait 2.5
ButtonClick
SetMousePosition 1,402,92
Wait 2.5
ButtonClick
Wait 2.5
SetMousePosition 1,179,31
Wait 2.5
ButtonClick

End Sub

 

any ideas?

chris

 



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

Christopher Allada

Cardiologist

Dragon Medical 11, Knowbrainer 2011, Dell Precision T3500 PC, Xeon W3520 CPU at 2.8GHz, Windows 7 Professional 64 bit, 12 GB ram

 03/14/2011 07:53 AM
User is offline View Users Profile Print this message

Author Icon
monkey8
Top-Tier Member

Posts: 1990
Joined: 01/14/2008

Chris

With the first script try using e.g.

SendSystemKeys"{Ctrl+k}"

Regards the second script, it is very difficult to work out why it doesn't work without visibly watching the screen.  You have done the correct thing by adding very large wait times just for debug purposes, however basically it's just a case of adding a step one by one and checking that each stage works.  Sounds like you have done this to an extent if you're saying that just the last step doesn't work.  All I can suggest is watching the mouse to see what it does and to try and make sense of what is happening.

Lindsay
www.pcbyvoice.com

 



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


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

 04/10/2011 03:11 AM
User is offline View Users Profile Print this message


csallada
New Member

Posts: 20
Joined: 02/10/2009

Dear Lindsay,

 

Thanks for all your help so far.

 

SendSystemKeys"{Ctrl+k}" has made this part of the command now work.

 

I now able to write the command completely. The issue of the command not working was related to me having two monitors and even though the recording of the mouse position was on the right monitor if the command editor was on the other monitor it was causing problems.

 

I now have 3 outstanding problems.

-how do i do a right mouse click instead of a left mouse click?

-is it possible to execute a command eg close file, save file within an advanced script command?

-is it possible to to have commands that have mouse clicks across 2 different monitors? (at the moment if i try i get coordinates out of bounds)

 

Chris



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

Christopher Allada

Cardiologist

Dragon Medical 11, Knowbrainer 2011, Dell Precision T3500 PC, Xeon W3520 CPU at 2.8GHz, Windows 7 Professional 64 bit, 12 GB ram

 04/12/2011 12:35 PM
User is offline View Users Profile Print this message

Author Icon
monkey8
Top-Tier Member

Posts: 1990
Joined: 01/14/2008

Quote:
how do i do a right mouse click instead of a left mouse click?

Hi Chris

The syntax for the mouse button clicks is:

ButtonClick x, y

if x = 1 then it is a left click
   x = 2 then it is a right click

if y = 1 then it is a single click
   y = 2 then it is a double click

so as an example a single right click would be:

ButtonClick 2,1

Quote:
-is it possible to execute a command eg close file, save file within an advanced script command?


Yes and there are various ways of doing this, one example is using keyboard shortcuts so the following script, as an example, would save a file with Microsoft Word or most applications for that matter:

Sub Main
SendDragonKeys"{Ctrl+s}"
End sub

you can find information on all these commands in the help files, alternatively there is a very useful book by Larry Allen on advanced scripting, "Larry Allen's advanced scripting guide", available from various places including KnowBrainer and www.PCspeak.com. If you are in the UK then you can get it from my website below or www.ITspeaking.co.uk

Quote:
-is it possible to to have commands that have mouse clicks across 2 different monitors? (at the moment if i try i get coordinates out of bounds)


yes you can do this but first you need to understand the syntax of the mouse positioning command:

SetMousePosition z, x, y

if z = 0 then the mouse position is relative to the top left-hand corner of your main monito
  z = 1 then the mouse position is relative to the top left corner of the current application window
  z = 2 then the mouse position is relative to the current mouse position

x, y are obviously the mouse coordinates

I don't know what type of command you are trying to create but in most cases these tend to be application-specific so the mouse would be positioned relative to the current active application window. In this case the command will work where ever the window is placed on any of the monitors as long as the window is the same size as when the command was created. The hardest part is working out the mouse coordinates and there are various ways of doing this. If you are talking about application-specific mouse positioning scripts then one possible solution is to do a screen print of the application window (Alt+PrtScr) and then open Microsoft paint and paste the screen print onto the Microsoft paint window (Ctrl+v). You can then manually position the mouse anywhere on the application window and Microsoft paint will show you the mouse coordinates.

An even better way of doing it is to use another script, which I can post for you if you want, and using this script (which is called something like "add mouse position command" you just call it and it will create all the necessary syntax for you and work out the mouse coordinates etc.

Lindsay
www.pcbyvoice.com



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


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

 04/12/2011 01:35 PM
User is offline View Users Profile Print this message

Author Icon
Lunis Orcutt
Top-Tier Member

Posts: 22636
Joined: 10/01/2006

You can also view the proper left-click and right-click mouse syntax by looking up the Left Click and Right Click commands in your KnowBrainer Command Browser. They are identical to the coding in NaturallySpeaking.

However, let's kick it up a notch. Begin by saying
Import KnowBrainer Commands. This particular KnowBrainer command will open the NaturallySpeaking Command Browser and import about 24 specialty commands that only work in DNS Pro, Medical or Legal (which you are using). One of these commands is called Find Mouse Position. Just click into the appropriate Window (so that NaturallySpeaking knows which application to focus on), move your cursor to the exact position you wish to record and say Find Mouse Position
. After this command records your Mouse Position it will verbally say “Mouse Position is ready to be pasted” because KnowBrainer talks. Yikes! When you paste the recorded Mouse Position into a DNS Advanced-Scripting command KnowBrainer will include the mouse X and Y Window coordinates, a slight pause and a mouse Left Click. All you will have to do is paste the code.

Additional note to end users who are not using 1 of the professional versions of DNS but have KnowBrainer… You can also perform the same function within
KnowBrainer 2011 via the following:

1. Say
Start Paint to open Microsoft Paint
2. Maximize both Microsoft Paint and the document contained in Microsoft Paint
3. Minimize Microsoft Paint to temporarily move it out of the way
4. Position your cursor exactly where you want to enable a mouse Left Click
5. Either say
Switch to Paint
or press {Alt+Tab} to pull up Microsoft Paint
6. Write down the numbers that you see in the lower left-hand corner of Microsoft Paint (make sure you are viewing at 100%). The 1st digit is your x-coordinate and the 2nd digit is your y-coordinate. Just leave out the px and you can add this information to a KnowBrainer
Mouse Area command.


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


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


 


 


 

 01/19/2012 05:18 PM
User is offline View Users Profile Print this message


gt1982
Junior Member

Posts: 3
Joined: 03/16/2009

Lindsay,

I have tried loading the "add advanced scripting command" by importing into Command Browser. It doesn't seem to be working for me. Does this command have to be a .dat file? Thanks for the help.

Greg

 01/19/2012 07:03 PM
User is offline View Users Profile Print this message

Author Icon
Chucker
Top-Tier Member

Posts: 9671
Joined: 10/10/2006

Greg,

If you imported Lindsay's command, the command name is "add mouse position", not "add advanced scripting command". Also, be careful what you name your commands just so that you don't inadvertently duplicate something that produces an entirely different or bizarre result.

Chuck Runquist
Technical Project Manager
VoiceTeach LLC
Home of VoicePower®: We don't make Dragon NaturallySpeaking, We make it better!

"Life's Rule #1: Once you pull the pin, Mr. Grenade is no longer your friend."  (Variant of Murphy's Law  -  Edward A. Murphy, Jr)



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

 01/19/2012 08:18 PM
User is offline View Users Profile Print this message


gt1982
Junior Member

Posts: 3
Joined: 03/16/2009

Lindsay,

Thank you. I continue to get an error message when I try to make the new commands. Please show me what the commands in "multiple positioning commands" would like in the My Commands Editor.

Thanks, Greg 

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

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