KnowBrainer Speech Recognition
Decrease font size
Increase font size
Topic Title: Question about <MouseButton_MouseAction>
Topic Summary:
Created On: 04/29/2022 04:48 PM
Status: Post and Reply
Linear : Threading : Single : Branch
 Question about <MouseButton_MouseAction>   - Mitchell Sturgeon - 04/29/2022 04:48 PM  
 Question about <MouseButton_MouseAction>   - Matt_Chambers - 04/29/2022 04:50 PM  
 Question about <MouseButton_MouseAction>   - Mitchell Sturgeon - 04/29/2022 07:53 PM  
 Question about <MouseButton_MouseAction>   - Matt_Chambers - 04/30/2022 07:50 AM  
 Question about <MouseButton_MouseAction>   - dilligence - 04/30/2022 11:26 AM  
 Question about <MouseButton_MouseAction>   - Mitchell Sturgeon - 04/30/2022 07:04 PM  
 Question about <MouseButton_MouseAction>   - monkey8 - 04/30/2022 03:16 PM  
 Question about <MouseButton_MouseAction>   - Matt_Chambers - 04/30/2022 03:49 PM  
Keyword
 04/29/2022 04:48 PM
User is offline View Users Profile Print this message

Author Icon
Mitchell Sturge..
New Member

Posts: 15
Joined: 03/10/2019

 

There is a command called

<MouseButton_MouseAction>

the code is as follows, and it works as expected:

'Script by Lindsay Adam www.pcbyvoice.com 2011
Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, _
ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, _
ByVal dwExtraInfo As Long)
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

I found some of the language burdensome, and shortened the highlighted lines in the following way, and now nothing happens when I speak the new command:

 

'Script by Lindsay Adam www.pcbyvoice.com 2011

Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, _

ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, _

ByVal dwExtraInfo As Long)

Sub Main

If ListVar1 = "Mouse Hold" then mouse_event (2, 0,0,0,0)

If ListVar1 = "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

 

Any assistance appreciated

 

 

 

 

 

 

 04/29/2022 04:50 PM
User is offline View Users Profile Print this message

Author Icon
Matt_Chambers
Top-Tier Member

Posts: 818
Joined: 08/09/2018

Did you make corresponding changes to the List items that comprise ListVar1?
 04/29/2022 07:53 PM
User is offline View Users Profile Print this message

Author Icon
Mitchell Sturge..
New Member

Posts: 15
Joined: 03/10/2019

Thank you. I don't know what that means…

What would the syntax be if I just wanted to make a command called "mouse hold" and another command called "mouse release"?



 04/30/2022 07:50 AM
User is offline View Users Profile Print this message

Author Icon
Matt_Chambers
Top-Tier Member

Posts: 818
Joined: 08/09/2018

It means that you need to edit the name of the command to reflect the changes you made in the script. You need to click on the part of the name that is (it is a list of items) and edit it to use your new shorter terms. You could just add your new shorter terms as new entries in the list.
 04/30/2022 11:26 AM
User is offline View Users Profile Print this message

Author Icon
dilligence
Top-Tier Member

Posts: 1681
Joined: 08/16/2010

The following only applies if you want to implement this voice command in Dragon® (i.e via the Dragon© Command Browser).

 

If this is meant to be a KnowBrainer command, then Lunis will probably explain to you how to do that (but the syntax should be the same).

 

 

I attached the command for you as well. Simply import it into your Dragon® Command Browser (overwrite the current command if the old one exists and you should be good to go):

 

 

 

 

 

 

 

 

By the way, performing mouse buttons operations via Advanced Scripting is not the fastest way. You may want to check out Press Utility© which is part of SP 7 Standard. This works much faster, there won't be any scripting hassle and you have many, many more options.

 

Here is the Demonstration Video.






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

https://speechproductivity.eu


Turbocharge your Dragon productivity with 40+ Power Addons



 04/30/2022 07:04 PM
User is offline View Users Profile Print this message

Author Icon
Mitchell Sturge..
New Member

Posts: 15
Joined: 03/10/2019

Thanks everyone! It's working.

 04/30/2022 03:16 PM
User is offline View Users Profile Print this message

Author Icon
monkey8
Top-Tier Member

Posts: 4186
Joined: 01/14/2008

As Matt says you need to change the names in the list as well as in the command. Although Rob has shown you how to do this with Dragon to do this with KB first of all open the command from the KB sidebar. Then click on "Edit Name". Then look at all the lists on the left hand side of the dialogue and find the list called "MouseButton_MouseAction". Once you find the list then click on "edit selected list" and then change the command name in the list to match what you changed in the script.

 

In terms of speed those commands should be absolutely instantaneous with KB.



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



 04/30/2022 03:49 PM
User is offline View Users Profile Print this message

Author Icon
Matt_Chambers
Top-Tier Member

Posts: 818
Joined: 08/09/2018

Yes, the speed should be fine.
Statistics
32613 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 221 guests browsing this forum, which makes a total of 222 users using this forum.

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