KnowBrainer Speech Recognition
Decrease font size
Increase font size
Topic Title: Advanced scripting command sends modifier key twice
Topic Summary:
Created On: 02/23/2022 07:00 PM
Status: Post and Reply
Linear : Threading : Single : Branch
 Advanced scripting command sends modifier key twice   - wristofdoom - 02/23/2022 07:00 PM  
 Advanced scripting command sends modifier key twice   - Alan Cantor - 02/23/2022 11:46 PM  
 Advanced scripting command sends modifier key twice   - Lunis Orcutt - 02/24/2022 02:56 PM  
 Advanced scripting command sends modifier key twice   - wristofdoom - 02/24/2022 05:06 PM  
 Advanced scripting command sends modifier key twice   - wristofdoom - 02/24/2022 01:57 AM  
 Advanced scripting command sends modifier key twice   - Ag - 02/24/2022 09:22 PM  
 Advanced scripting command sends modifier key twice   - wristofdoom - 02/25/2022 12:50 AM  
 Advanced scripting command sends modifier key twice   - Edgar - 02/25/2022 10:03 AM  
Keyword
 02/23/2022 07:00 PM
User is offline View Users Profile Print this message

Author Icon
wristofdoom
Top-Tier Member

Posts: 347
Joined: 09/03/2020

I have an Autohotkey script that does various things to media using the Windows and F-row hotkeys. For example, Windows+F7 will play or pause the current song in my media player.

 

I'm trying to create a Dragon advanced script that will trigger these same hotkeys. 

 

Here's my full code: https://pastebin.com/0kakwVsy

 

It works, but with a catch: after I dictate a command like "pause track", the desired action is performed (Windows + F7 is sent and the track pauses), but then it also behaves as though the Windows key has been pressed a 2nd time.

 

Note: I have stickey keys enabled. However, I have many other commands that send modifier keys like this, and this behavior does not occur.

 

So, if I were to press the "up arrow" key after using this command, then my window will resize (the equivalent of pressing Windows key + up arrow).

 

I've tried this with other modifier keys with the same results. For example, if I change the hotkey to shift + F7, then if I utter the command "pause track" and then afterwards I click somewhere with the mouse, it will behave as though I have done a "shift click".

 

So it's almost like instead of sending "+{F7}" it's sending "+{F7}+"

 

Any ideas what could be going on here?

 

Thanks

 

Update:

 

I haven't figured out the original issue, but I was able to get an advance script working that controls media directly without involving Autohotkeys, funky pop-ups, or other third-party scripting.

 

Code is here for anybody interested: 

 

https://pastebin.com/3DLrZnkC

 



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

Dragon Professional Individual v15.6. Windows 10. Knowbrainer 2017.



 02/23/2022 11:46 PM
User is offline View Users Profile Print this message


Alan Cantor
Top-Tier Member

Posts: 4615
Joined: 12/08/2007


Any ideas what could be going on here?



Not 100% sure, but I suspect the problem resides in statements like this:

SendKeys "{Windowshold}{F8}", 1

Perhaps the Windows key isn't released after it is held, which triggers the Start menu?

You might need to change the hotkey activations for the AutoHotkey scripts. Maybe Ctrl + Alt + function keys?
 02/24/2022 02:56 PM
User is offline View Users Profile Print this message

Author Icon
Lunis Orcutt
Top-Tier Member

Posts: 40906
Joined: 10/01/2006

Will SendKeys "{WindowsHold}{F8}" work?



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

Change "No" to "Know" w/KnowBrainer 2022
Trial Downloads
Dragon/Sales@KnowBrainer.com 
(615) 884-4558 ex 1

 02/24/2022 05:06 PM
User is offline View Users Profile Print this message

Author Icon
wristofdoom
Top-Tier Member

Posts: 347
Joined: 09/03/2020

No, that's the code that wasn't working originally. 



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

Dragon Professional Individual v15.6. Windows 10. Knowbrainer 2017.

 02/24/2022 01:57 AM
User is offline View Users Profile Print this message

Author Icon
wristofdoom
Top-Tier Member

Posts: 347
Joined: 09/03/2020

Thanks but not the solution unfortunately. I've tried this with other modifier keys with the same results. For example, if I change the hotkey to shift + F7, then if I utter the command "pause track" and then afterwards I click somewhere with the mouse, it will behave as though I have done a "shift click".

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

Dragon Professional Individual v15.6. Windows 10. Knowbrainer 2017.

 02/24/2022 09:22 PM
User is offline View Users Profile Print this message

Author Icon
Ag
Top-Tier Member

Posts: 1150
Joined: 07/08/2019

If your original autohotkey script works fine, but your Dragon Basic script doesn't...

(AutoHotKey handling of Windows key via the # modifier, or {LWin up/down} etc seems more mature than Dragon's)

... why not just have your Dragon speech command invoke your AutoHotKey script?

(Or more likely a tweaked AHK script.)


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

DPG15.6 (also DPI 15.3) + KB, Sennheiser MB Pro 1 UC ML, BTD 800 dongle, Windows 10 Pro, MS Surface Book 3, Intel Core i7-1065G7 CPU @ 1.3/1.5GHz (4 cores, 8 logical, GPU=NVIDIA Quadro RTX 3000 with Max-Q Design.

 02/25/2022 12:50 AM
User is offline View Users Profile Print this message

Author Icon
wristofdoom
Top-Tier Member

Posts: 347
Joined: 09/03/2020

Originally posted by: Ag If your original autohotkey script works fine, but your Dragon Basic script doesn't... (AutoHotKey handling of Windows key via the # modifier, or {LWin up/down} etc seems more mature than Dragon's) ... why not just have your Dragon speech command invoke your AutoHotKey script? (Or more likely a tweaked AHK script.)

 

How would I go about doing that?



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

Dragon Professional Individual v15.6. Windows 10. Knowbrainer 2017.

 02/25/2022 10:03 AM
User is offline View Users Profile Print this message

Author Icon
Edgar
Top-Tier Member

Posts: 1396
Joined: 04/03/2009

just do something like this:

Sub Main

   ShellExecute "D:\RearrangeVisualStudio\RearrangeVisualStudio.exe"

End Sub

In your case, what would be inside the quotation marks would be the full path to the script you want to run. This can be accomplished with DVC as well as traditional Advanced Scripting.



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

-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 & Shokz OpenComm UC version 1 wireless headset, 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

Statistics
32616 users are registered to the KnowBrainer Speech Recognition forum.
There are currently 0 users logged in.
The most users ever online was 12124 on 09/09/2020 at 04:59 AM.
There are currently 265 guests browsing this forum, which makes a total of 265 users using this forum.

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