KnowBrainer Speech Recognition
Decrease font size
Increase font size
Topic Title: Advanced Scripting syntax to press and hold one of the mouse buttons
Topic Summary:
Created On: 02/18/2016 10:26 PM
Status: Post and Reply
Linear : Threading : Single : Branch
 Advanced Scripting syntax to press and hold one of the mouse buttons   - WeThotUWasAToad - 02/18/2016 10:26 PM  
 Advanced Scripting syntax to press and hold one of the mouse buttons   - Lunis Orcutt - 02/18/2016 10:42 PM  
 Advanced Scripting syntax to press and hold one of the mouse buttons   - WeThotUWasAToad - 02/18/2016 11:09 PM  
 Advanced Scripting syntax to press and hold one of the mouse buttons   - MikeJ - 02/19/2016 02:08 PM  
 Advanced Scripting syntax to press and hold one of the mouse buttons   - Mphillipson - 02/19/2016 11:27 AM  
 Advanced Scripting syntax to press and hold one of the mouse buttons   - PG LTU - 02/19/2016 03:49 PM  
 Advanced Scripting syntax to press and hold one of the mouse buttons   - Lunis Orcutt - 02/19/2016 06:16 PM  
 Advanced Scripting syntax to press and hold one of the mouse buttons   - WeThotUWasAToad - 02/19/2016 08:37 PM  
 Advanced Scripting syntax to press and hold one of the mouse buttons   - PG LTU - 02/20/2016 01:27 PM  
 Advanced Scripting syntax to press and hold one of the mouse buttons   - MikeJ - 02/19/2016 11:41 PM  
 Advanced Scripting syntax to press and hold one of the mouse buttons   - WeThotUWasAToad - 02/21/2016 12:31 AM  
 Advanced Scripting syntax to press and hold one of the mouse buttons   - Mphillipson - 02/21/2016 02:14 PM  
 Advanced Scripting syntax to press and hold one of the mouse buttons   - WeThotUWasAToad - 02/21/2016 09:23 PM  
 Advanced Scripting syntax to press and hold one of the mouse buttons   - Mphillipson - 02/22/2016 11:23 AM  
 Advanced Scripting syntax to press and hold one of the mouse buttons   - WeThotUWasAToad - 02/22/2016 12:57 PM  
 Advanced Scripting syntax to press and hold one of the mouse buttons   - rolbit - 05/04/2019 09:39 AM  
 Advanced Scripting syntax to press and hold one of the mouse buttons   - TheCyborgManatee - 01/11/2020 03:10 PM  
 Advanced Scripting syntax to press and hold one of the mouse buttons   - Lunis Orcutt - 01/11/2020 08:37 PM  
 Advanced Scripting syntax to press and hold one of the mouse buttons   - dilligence - 01/11/2020 09:09 PM  
 Advanced Scripting syntax to press and hold one of the mouse buttons   - TheCyborgManatee - 01/16/2020 06:46 PM  
 Advanced Scripting syntax to press and hold one of the mouse buttons   - Lunis Orcutt - 01/16/2020 07:28 PM  
Keyword
 02/18/2016 10:26 PM
User is offline View Users Profile Print this message

Author Icon
WeThotUWasAToad
Senior Member

Posts: 87
Joined: 01/22/2014

Hello,

 

What is the proper syntax using Advanced Scripting in the Command Editor to place one of the mouse buttons in the down or "held-down" position?

 

DNS obviously comes with built-in commands to click the left, middle, or right mouse buttons. However, I'm looking for a way to use voice commands to place any of those buttons in the down position and have it remain there until a second voice command releases it.

 

For example, using the Snipping Tool (Windows > Start > Accessories > Snipping Tool), involves:

1) placing the mouse cursor at a screen location to be the upper-left corner of the snip,

2) pressing and holding the left mouse button,

3) moving the mouse cursor to a new location intended as the lower-right corner of the snip, and

4) releasing the left mouse button.

 

I am looking for voice commands to replace steps #2 & #4 so that I can:

1) place the mouse cursor at the desired upper-left corner of the snip,

2) say something like, "press and hold left mouse button",

3) move the mouse cursor to the desired lower-right quarter,

4) say something like, "release left mouse button",

 

...and get the same result as above.

 

Thanks



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

 


A ____________________ [A LOT OF SPACE] ____________________ LOT


 


"ALOT" is not a word — it never has been a word and it never will be a word.


"A LOT" is 2 words. Remember it as though there's [A LOT OF SPACE] between them.



 02/18/2016 10:42 PM
User is offline View Users Profile Print this message

Author Icon
Lunis Orcutt
Top-Tier Member

Posts: 37467
Joined: 10/01/2006

                    Welcome to the World's Most Popular Speech Recognition Forum

This feature is built into KnowBrainer 2016. You'll find a 30 day trial in our signature tag but you should be able to copy the following code into a Dragon advanced scripting command. Dragon uses a dated scripting language called SAX scripting which was discontinued in 2004. KnowBrainer uses WinWrap Basic which supposedly is 200 times faster but both utilities can use the same VB code so you should be able to copy the following script. Good luck.



Sub Main
If ListVar1 = "LEFT Mouse Hold Down" Then mouse_event (2, 0,0,0,0)
If ListVar1 = "LEFT Mouse Release" Then mouse_event (4, 0,0,0,0)
If ListVar1 = "RIGHT Mouse Hold Down" Then mouse_event (8, 0,0,0,0)
If ListVar1 = "RIGHT Mouse Release" Then mouse_event (16, 0,0,0,0)
End Sub



 

Following list is also needed (sorry about forgetting this earlier)
 

LEFT Mouse Hold Down

LEFT Mouse Release

RIGHT Mouse Hold Down

RIGHT Mouse Release

 

 

 

 



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

Forum Mission Statement
Trial Downloads
Dragon/Sales@KnowBrainer.com 
(615) 884-4558 ext 1



 02/18/2016 11:09 PM
User is offline View Users Profile Print this message

Author Icon
WeThotUWasAToad
Senior Member

Posts: 87
Joined: 01/22/2014

Lunis,

Thanks for the prompt reply.

I tried inserting what you included into my Command Editor but kept getting an error message.

Unfortunately, my knowledge and experience of creating commands doesn't go far beyond entering my desired voice command in the top field and then using either:

SendKeys "_"
or
SendSystemKeys "{_}"

So from your post, what should I enter as the command name? I tried exactly what you've got:



...but it gave me an error.

Also, do I need to include what's in your screenshot beginning with, "Private Declare Sub..."?

Thanks

PS What about for holding down in releasing the middle mouse button?


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

 


A ____________________ [A LOT OF SPACE] ____________________ LOT


 


"ALOT" is not a word — it never has been a word and it never will be a word.


"A LOT" is 2 words. Remember it as though there's [A LOT OF SPACE] between them.

 02/19/2016 02:08 PM
User is offline View Users Profile Print this message


MikeJ
Top-Tier Member

Posts: 1082
Joined: 10/03/2006

Originally posted by: WeThotUWasAToad Lunis, Thanks for the prompt reply. I tried inserting what you included into my Command Editor but kept getting an error message.


That's because Lunis' post is missing significant pieces of information to make the script work. The command is what's called a list command which requires a list that Lunis didn't include. He also did not include the entire contents of the script, neglecting to copy and paste the declaration section of the script into what he pasted into the post.

Your best bet is to import Mark's command into your Command Browser because that should include everything you need.

 02/19/2016 11:27 AM
User is offline View Users Profile Print this message

Author Icon
Mphillipson
Advanced Member

Posts: 194
Joined: 09/22/2014

Please find attached an Advanced Script in XML format which can be imported into the Command Browser.

 

This will allow you to hold down Left, Right or Middle Buttons and release them.

 

 






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

Thanks Mark


 


 


 


Dragon Professional Advanced Scripting/KnowBrainer Scripts
Video Examples of Coding by Voice

 02/19/2016 03:49 PM
User is offline View Users Profile Print this message

Author Icon
PG LTU
Top-Tier Member

Posts: 1951
Joined: 03/21/2007

Well, to be fair, all of the info you need is in Lunis' screenshot.

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




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.

 02/19/2016 06:16 PM
User is offline View Users Profile Print this message

Author Icon
Lunis Orcutt
Top-Tier Member

Posts: 37467
Joined: 10/01/2006

Oops, sorry about forgetting the important list portion of the command because we already have it set up and KnowBrainer. We edited our original answer but Mark's command, in XML format, is the best solution because you can import it into Dragon.



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

Forum Mission Statement
Trial Downloads
Dragon/Sales@KnowBrainer.com 
(615) 884-4558 ext 1

 02/19/2016 08:37 PM
User is offline View Users Profile Print this message

Author Icon
WeThotUWasAToad
Senior Member

Posts: 87
Joined: 01/22/2014

You guys are awesome to be offering all this help and I really appreciate it but unfortunately, I cannot determine how to get the posted file into my Command Browser. I'm certainly familiar with importing data into an app but I don't remember ever doing that in DNS. 

 

I found the import option easy enough by going to:

 

DNS Command Browser > Mode > Manage > Import

 

...so that part seems to be straightforward but perhaps my problem is understanding how to handle the .xml file.

 

When I click the link "HoldingMouseDown.xmxl" in Mphillipsons post, it opens a new browser tab (in Chrome) with a heading that reads:

 

"This XML file does not appear to have any style information associated with it. The document tree is shown below."

 

...followed by what I am sure is the code needing to be imported. But where do I go from there?

 

I looked in my Chrome Downloads folder and found a new file from KnowBrainer with the filename: 

 

viewattachment.cfm.xml

 

...which I copied/pasted into another folder. But then when I navigated to that folder from the Command Browser import option, the folder appears empty.

 

I'm sure this has got a simple solution -- but the solutions are always simple once you understand them.

 

If someone could explain where I'm messing up, I'd be grateful.

 

Thanks again.

 

PS I am pumped to be getting this new set of commands.



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

 


A ____________________ [A LOT OF SPACE] ____________________ LOT


 


"ALOT" is not a word — it never has been a word and it never will be a word.


"A LOT" is 2 words. Remember it as though there's [A LOT OF SPACE] between them.

 02/20/2016 01:27 PM
User is offline View Users Profile Print this message

Author Icon
PG LTU
Top-Tier Member

Posts: 1951
Joined: 03/21/2007

Originally posted by: Lunis Orcutt Oops, sorry about forgetting the important list portion of the command.

 

Lunis, you also forgot to include the sub mouse_event function in your edited answer . . .



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




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.

 02/19/2016 11:41 PM
User is offline View Users Profile Print this message


MikeJ
Top-Tier Member

Posts: 1082
Joined: 10/03/2006

In order for the import to work the file has to be on your PC so it needs to be downloaded. Instead of left clicking on the file in Chrome, try Right-clicking and then selecting the option to save the file to your computer. I don't use Chrome so I'm not sure what the exact verbiage of that option is in Chrome but it should be fairly obvious.

Next do the 'DNS Command Browser > Mode > Manage > Import' steps again and browse to the location where you saved the file and it should import correctly.
 02/21/2016 12:31 AM
User is offline View Users Profile Print this message

Author Icon
WeThotUWasAToad
Senior Member

Posts: 87
Joined: 01/22/2014

OK, it worked! And it is awesome!

FYI, I'm a quad and I use DNS constantly but that one has been troublesome because, although I have some movement in my arms, I fatigue quickly. I have a trackball and, using AutoHotkey, I mapped some keys to imitate mouse buttons. However, pressing and holding them has been a problem -- especially for gaming (WoW).

Two more questions if I may.

1) Although the import went smoothly, I did get a pop-up saying:

---------------------------------------
Import Commands
Would you like to validate the
"C:XUsersXSteveXFOLDERS-BY-TAGXc Computerxcs SoftwareXHoldingM
ouseDown.xml" file using the following Data Type Definition?
http://www.nuance.com/NaturallySpeaking/Support/MyCommands/MyCmds11.dtd
You should be connected to the Internet before pressing "Yes
Yes
No
---------------------------------------

Is that to be expected?

2) The commands are working great but I could not find them in my Command Browser and I would like to change the Command Name if that's doable. Can you tell me how to do that?

Thanks again!

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

 


A ____________________ [A LOT OF SPACE] ____________________ LOT


 


"ALOT" is not a word — it never has been a word and it never will be a word.


"A LOT" is 2 words. Remember it as though there's [A LOT OF SPACE] between them.

 02/21/2016 02:14 PM
User is offline View Users Profile Print this message

Author Icon
Mphillipson
Advanced Member

Posts: 194
Joined: 09/22/2014

The script will appear under your Global Commands at the top because it starts with a list as indicated in the following screenshot:

http://screencast.com/t/0B5x2OYUe

Unfortunately if you rename the command it may not work because it relies on the 2 lists enclosed in angle brackets (<leftrightmiddle> Mouse <down_up>.  You can change the Mouse in the name if you wish without any ill effects, but the lists will need to be in the same position and named the same or least in the same order I guess you could put mouse at the beginning or another word like the following:
Mouse <leftrightmiddle> <down_up>

Regarding the prompt you get when you reimport that happens all the time and is nothing to worry about.  It's just the system checking that the file is in a valid format.



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

Thanks Mark


 


 


 


Dragon Professional Advanced Scripting/KnowBrainer Scripts
Video Examples of Coding by Voice

 02/21/2016 09:23 PM
User is offline View Users Profile Print this message

Author Icon
WeThotUWasAToad
Senior Member

Posts: 87
Joined: 01/22/2014

Mark,

 

That makes perfect sense and thanks for the explanation. This script is far beyond anything I've used before but in addition to providing the functionality I was seeking, it gives me a great example from which to learn more about creating my own commands since, for me, studying scripts is always much more productive when I already understand what they do.

 

I recognize the convenience of having a single command with three beginning options (left, right & middle) and two ending options (down & up). However, I'm wondering if the code were to be modified into a form which does not include the beginning and ending options (ie so that a fixed command is defined and only a single action ensues), if it would then be more conducive to a change in the command. For example, the command could be "DownClick" and the action could be to hold down the middle mouse button.

 

I realize that going that route would necessitate six separate command scripts to provide the same options as your single script currently does but for my remedial knowledge, I think it would be a more usable in that form. Plus, I want to see if, having a script for only one of the six actions, I can determine how it must be altered to enable another action.

 

Thanks



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

 


A ____________________ [A LOT OF SPACE] ____________________ LOT


 


"ALOT" is not a word — it never has been a word and it never will be a word.


"A LOT" is 2 words. Remember it as though there's [A LOT OF SPACE] between them.



 02/22/2016 11:23 AM
User is offline View Users Profile Print this message

Author Icon
Mphillipson
Advanced Member

Posts: 194
Joined: 09/22/2014

If you created a command just to hold the left mouse button down it would look something like the following screenshot:

 http://screencast.com/t/S3WM9QKkiaJq

 

 



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

Thanks Mark


 


 


 


Dragon Professional Advanced Scripting/KnowBrainer Scripts
Video Examples of Coding by Voice

 02/22/2016 12:57 PM
User is offline View Users Profile Print this message

Author Icon
WeThotUWasAToad
Senior Member

Posts: 87
Joined: 01/22/2014

That's perfect and just what I was hoping for Mark.

 

Now I've got your code with its options and six other new commands in which I can modify the Command Name.

 

Many many thanks!



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

 


A ____________________ [A LOT OF SPACE] ____________________ LOT


 


"ALOT" is not a word — it never has been a word and it never will be a word.


"A LOT" is 2 words. Remember it as though there's [A LOT OF SPACE] between them.



 05/04/2019 09:39 AM
User is offline View Users Profile Print this message

Author Icon
rolbit
New Member

Posts: 9
Joined: 03/16/2019

You guys are amazing! Mark's script is exactly what I was looking for. I am a quadruplegic using Dragon to control my computer. I can move the mouse with the joystick of my power wheelchair. But clicking and especially holding the mouse button is a bit complicated.

Thanks again
Roland
 01/11/2020 03:10 PM
User is offline View Users Profile Print this message

Author Icon
TheCyborgManate..
New Member

Posts: 2
Joined: 01/11/2020

I managed to stumble across the site and this particular thread after much googling, but unfortunately it seems that Mark's script is no longer available! Can any of you guys provide a link to that script? Thanks!
 01/11/2020 08:37 PM
User is offline View Users Profile Print this message

Author Icon
Lunis Orcutt
Top-Tier Member

Posts: 37467
Joined: 10/01/2006

                    Welcome to the World's Most Popular (now only) Speech Recognition Forum's

Were you able to view the SnagIt picture when you clicked http://screencast.com/t/S3WM9QKkiaJq link? If not, try pasting it into an alternate browser.



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

Forum Mission Statement
Trial Downloads
Dragon/Sales@KnowBrainer.com 
(615) 884-4558 ext 1

 01/11/2020 09:09 PM
User is offline View Users Profile Print this message

Author Icon
dilligence
Top-Tier Member

Posts: 1044
Joined: 08/16/2010

Advanced Scripting commands to hold down the mouse buttons (and certain keyboard keys) were initially created by Lindsay Adam (programmer of SpeechStart+/KnowBrainer 2017). These commands have proven to be very reliable.

 

The downside of Advanced Scripting commands (sadly these commands cannot be created with DVC scripting) is that deployment can be somewhat slow. Although in DPG 15.5 and KnowBrainer 2017 deployment is faster, pressing the mouse buttons should actually be (almost) instantaneous. Therefore hands-free users (gamers) should check out SP Press Utility which is part of SP Utilities. It presses the left or right mouse button almost instantly and it also has great support for VoiceComputer:

 

Here is a demonstration video:

http://vimeo.com/329169567



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

www.speechproductivity.eu 


The Ultimate Dictation Box for Dragon - SP Ergonomic Text Editor - Hotkeys for Dragon - Better Text to Speech - Easy Guide to Dragon Scripting



 01/16/2020 06:46 PM
User is offline View Users Profile Print this message

Author Icon
TheCyborgManate..
New Member

Posts: 2
Joined: 01/11/2020

Originally posted by: Lunis Orcutt                     Welcome to the World's Most Popular (now only) Speech Recognition Forum's Were you able to view the SnagIt picture when you clicked http://screencast.com/t/S3WM9QKkiaJq link? If not, try pasting it into an alternate browser.

 

 

I did look at that but that screenshot is specifically for left click only and I'm not fluent enough in scripts to know how to modify it for right clicking as well.

Originally posted by: dilligence Advanced Scripting commands to hold down the mouse buttons…

 

I wasn't aware of the other programs you mentioned. I'll have to look into them.

 



 01/16/2020 07:28 PM
User is offline View Users Profile Print this message

Author Icon
Lunis Orcutt
Top-Tier Member

Posts: 37467
Joined: 10/01/2006

If you go back to the original SnagIt picture, you'll see that includes Left Click, Middle Click and Right Click. This is a multi-choice Advanced-Scripting command.



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

Forum Mission Statement
Trial Downloads
Dragon/Sales@KnowBrainer.com 
(615) 884-4558 ext 1



Statistics
31595 users are registered to the KnowBrainer Speech Recognition forum.
There are currently 0 users logged in.
The most users ever online was 3936 on 09/08/2015 at 11:44 AM.
There are currently 320 guests browsing this forum, which makes a total of 320 users using this forum.

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