KnowBrainer Speech Recognition
Decrease font size
Increase font size
Topic Title: Held down keys won't release
Topic Summary:
Created On: 11/16/2020 07:54 PM
Status: Post and Reply
Linear : Threading : Single : Branch
 Held down keys won't release   - TheCyborgManatee - 11/16/2020 07:54 PM  
 Held down keys won't release   - Edgar - 11/17/2020 11:17 AM  
 Held down keys won't release   - monkey8 - 11/21/2020 06:03 AM  
 Held down keys won't release   - monkey8 - 11/24/2020 02:32 PM  
Keyword
 11/16/2020 07:54 PM
User is offline View Users Profile Print this message

Author Icon
TheCyborgManate..
New Member

Posts: 3
Joined: 01/11/2020

I just picked up KnowBrainer and I'm running into a couple of issues. When I use the command to hold down mouse buttons (left mouse hold down, etc.), the release command doesn't appear to do anything. I have to physically click the mouse to get it to release. The same is also true if I try to use the command for holding down specific keys.

 

Even more strangely, when I say "shift click" (I'm assuming this is supposed to work like clicking the mouse and pressing shift at the same time, but correct me if I'm wrong), my cursor will be immediately pinned to the upper left even if my cursor is on my second monitor. It literally goes all the way across to the other monitor in the very upper left.

 

Has anybody else run into this problem before? It's one of the main functions I was really hoping to take advantage of, but it's obviously not working in a functional way for me. 

 11/17/2020 11:17 AM
User is offline View Users Profile Print this message

Author Icon
Edgar
Top-Tier Member

Posts: 1042
Joined: 04/03/2009

Originally posted by: TheCyborgManatee   the release command doesn't appear to do anything. 

 

when I say "shift click" […] my cursor will be immediately pinned to the upper left

When first published, the Hold/Release key/button scripts had a typo error which would have caused your first problem. It sounds like your "Hold" command is working properly; just for completeness it should look something vaguely like this:

Sub Main

   If ListVar1 = "WINDOWS Key" Then keybd_event(VK_LWIN,0,0,0)
   If ListVar1 = "CONTROL Key" Then keybd_event(VK_CTRL,0,0,0)
   If ListVar1 = "SHIFT Key" Then keybd_event(VK_SHIFT,0,0,0)
   If ListVar1 = "ALT Key" Then keybd_event(VK_ALT,0,0,0)
   If ListVar1 = "SPACE Key" Then keybd_event(VK_SPACE,0,0,0)

 

End Sub

The "Release" command should look something like this:

Sub Main

   If ListVar1 = "WINDOWS Key" Then keybd_event(VK_LWIN,0, 2,0)
   If ListVar1 = "CONTROL Key" Then keybd_event(VK_CTRL,0, 2,0)
   If ListVar1 = "SHIFT Key" Then keybd_event(VK_SHIFT,0, 2,0)
   If ListVar1 = "ALT Key" Then keybd_event(VK_ALT,0, 2,0)
   If ListVar1 = "SPACE Key" Then keybd_event(VK_SPACE,0, 2,0)

End Sub

Note that at the end of each line there is a series of comma separated numerals; for the "Hold" command they should all be 0s, for the "Release" command the middle should be a 2.

You'll have to post the code to your "Shift Click" command, my look something like this:

Type POINT

   x As Long
   y As Long

End Type

Declare Function GetCursorPos Lib "user32" Alias "GetCursorPos" (lpPoint As POINT) As Long

Sub Main

   Dim z As POINT

   GetCursorPos z 'Get cursor's current Coordinates
   Wait 0.2
   SendKeys "+{ClickLeft " & z.x &"," & z.y &"}", 1

End Sub

Note that, for me, the line which starts out with "Declare Function" and ends with "As Long" is all on one line; if it is broken up all but the last line must end with a "_". Also, the word POINT might be different in your version but it doesn't matter as long as it is consistent in all three locations in the code.



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

-Edgar
DPI 15.3, 64-bit Windows 10 Pro, OpenOffice & Office 365, Norton Security, Shure X2U XLR to USB mic adapter with Audio Technica DB135 vocal mic, Asus X299-Deluxe Prime, Intel Core i9-7940X (14 core, 4.3 GHz overclocked to 4.9 GHz), G.SKILL TridentZ Series 64GB (4 x 16GB) DDR4 3333 (PC4 26600) F4-3333C16Q-64GTZ, NVIDIA GIGABYTE GeForce GTX 1060 GV-N1060G1 GAMING-6GD REV 2.0 6GB graphics card with 3 1920x1080 monitors

 11/21/2020 06:03 AM
User is offline View Users Profile Print this message

Author Icon
monkey8
Top-Tier Member

Posts: 3701
Joined: 01/14/2008

In terms of "shift click" try saying "press shift left click", likewise "press control left click", these commands are already built into Dragon.

 

In terms of holding down mouse buttons keys, the commands should work in KB "left mouse hold down", "left mouse release". If not I suggest contacting Lunis who may arrange a remote connection if necessary. 

 

In terms of the "shift click" command in KB, I just looked at it and the SendKeys implementation does not work so you could change the command to the following:

 

' www.pcbyvoice.com
' Declare keyboard events Windows API function
Declare Function keybd_event Lib "user32.dll" (ByVal vKey As _
Long, bScan As Long, ByVal Flag As Long, ByVal exInfo As Long) As Long
' declare virtual key constant for the shift key
Const VK_CTRL = &h11
Const VK_SHIFT = &h10
Sub Main
'hold down the shift key
keybd_event(VK_SHIFT,0,0,0)
Wait 0.1 
ButtonClick 1,1
Wait 0.1
'release the shift key
keybd_event(VK_SHIFT,0,2,0)
End Sub

 

or alternatively you can HeardWord the built in Dragon commands.

 

EDIT: one other very important item here is if you issue the commands "control key hold down" or alternatively "shift key hold down" these will conflict with the hotkeys for Dragon for forcing dictation and commands. You need to change the hotkeys to something like "{Ctrl+Shift}" and "{Alt + Shift}" 



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



 11/24/2020 02:32 PM
User is offline View Users Profile Print this message

Author Icon
monkey8
Top-Tier Member

Posts: 3701
Joined: 01/14/2008

I just had another look at this with the existing KnowBrainerCommands set and there is a problem with the "<Keyname> Release>" command which is not obvious to see. If you open the command and then delete all the contents in the editor and replace with the following it should then work fine. It will be fixed with the next command set release, KB update.

 

' Script Lindsay Adam 2010 www.pcbyvoice.com
' Declare keyboard events Windows API function
Declare Function keybd_event Lib "user32.dll" (ByVal vKey As _
Long, bScan As Long, ByVal Flag As Long, ByVal exInfo As Long) As Long
' declare virtual key constant for the left Windows key,
' control key, shift key and alt key
Const VK_LWIN = &h5B
Const VK_CTRL = &h11
Const VK_SHIFT = &h10
Const VK_ALT = &h12
Const VK_SPACE = &h20

Sub Main
If ListVar1 = "WINDOWS Key" Then keybd_event(VK_LWIN,0,2,0)
If ListVar1 = "CONTROL Key" Then keybd_event(VK_CTRL,0,2,0)
If ListVar1 = "SHIFT Key" Then keybd_event(VK_SHIFT,0,2,0)
If ListVar1 = "ALT Key" Then keybd_event(VK_ALT,0,2,0)
If ListVar1 = "SPACE Key" Then keybd_event(VK_SPACE,0,2,0)
End Sub


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

KnowBrainer Speech Recognition » KnowBrainer Software and Support » Held down keys won't release

Statistics
31943 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 541 guests browsing this forum, which makes a total of 542 users using this forum.

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