KnowBrainer Speech Recognition
Decrease font size
Increase font size
Topic Title: In DNS Advanced Scripting, how do I send the Windows key?
Topic Summary:
Created On: 09/09/2020 06:01 PM
Status: Post and Reply
Linear : Threading : Single : Branch
 In DNS Advanced Scripting, how do I send the Windows key?   - wristofdoom - 09/09/2020 06:01 PM  
 In DNS Advanced Scripting, how do I send the Windows key?   - dilligence - 09/09/2020 06:34 PM  
 In DNS Advanced Scripting, how do I send the Windows key?   - Lunis Orcutt - 09/09/2020 06:47 PM  
 In DNS Advanced Scripting, how do I send the Windows key?   - wristofdoom - 09/10/2020 10:41 AM  
 In DNS Advanced Scripting, how do I send the Windows key?   - wristofdoom - 09/10/2020 12:33 PM  
 In DNS Advanced Scripting, how do I send the Windows key?   - wristofdoom - 09/12/2020 09:05 PM  
 In DNS Advanced Scripting, how do I send the Windows key?   - dilligence - 09/12/2020 09:16 PM  
 In DNS Advanced Scripting, how do I send the Windows key?   - wristofdoom - 09/12/2020 09:47 PM  
 In DNS Advanced Scripting, how do I send the Windows key?   - MDH - 09/12/2020 09:55 PM  
 In DNS Advanced Scripting, how do I send the Windows key?   - Lunis Orcutt - 09/12/2020 10:41 PM  
 In DNS Advanced Scripting, how do I send the Windows key?   - Matt_Chambers - 09/13/2020 07:53 AM  
 In DNS Advanced Scripting, how do I send the Windows key?   - IceRafter - 11/16/2021 08:50 AM  
 In DNS Advanced Scripting, how do I send the Windows key?   - Matt_Chambers - 11/16/2021 11:09 AM  
 In DNS Advanced Scripting, how do I send the Windows key?   - Lunis Orcutt - 11/16/2021 12:45 PM  
 In DNS Advanced Scripting, how do I send the Windows key?   - jmcvay - 11/20/2021 03:57 PM  
 In DNS Advanced Scripting, how do I send the Windows key?   - Matt_Chambers - 11/20/2021 04:27 PM  
 In DNS Advanced Scripting, how do I send the Windows key?   - Lunis Orcutt - 11/21/2021 04:08 PM  
 In DNS Advanced Scripting, how do I send the Windows key?   - Matt_Chambers - 11/21/2021 04:13 PM  
 In DNS Advanced Scripting, how do I send the Windows key?   - jmcvay - 11/22/2021 11:26 AM  
 In DNS Advanced Scripting, how do I send the Windows key?   - kkkwj - 11/20/2021 04:22 PM  
 In DNS Advanced Scripting, how do I send the Windows key?   - Lunis Orcutt - 11/21/2021 07:33 PM  
 In DNS Advanced Scripting, how do I send the Windows key?   - Matt_Chambers - 11/22/2021 07:02 AM  
 In DNS Advanced Scripting, how do I send the Windows key?   - monkey8 - 12/04/2021 07:08 AM  
 In DNS Advanced Scripting, how do I send the Windows key?   - kkkwj - 12/05/2021 05:43 PM  
 In DNS Advanced Scripting, how do I send the Windows key?   - monkey8 - 12/08/2021 10:51 AM  
 In DNS Advanced Scripting, how do I send the Windows key?   - wristofdoom - 02/19/2022 06:09 PM  
 In DNS Advanced Scripting, how do I send the Windows key?   - Alan Cantor - 02/19/2022 07:53 PM  
Keyword
 09/09/2020 06:34 PM
User is offline View Users Profile Print this message

Author Icon
dilligence
Top-Tier Member

Posts: 1499
Joined: 08/16/2010

It's very easy to do with a DVC command (double-click an existing one in your Dragon Command Browser and then click Create New button):

 

SendSystemKeys "{win}"

Wait 500

SendKeys "Knowbrainer professional 2017"

Wait 200

SendSystemKeys "{Enter}"



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

https://speechproductivity.eu


Turbocharge your Dragon® productivity with 40 Power Addons



 09/09/2020 06:47 PM
User is offline View Users Profile Print this message

Author Icon
Lunis Orcutt
Top-Tier Member

Posts: 39769
Joined: 10/01/2006

Just a very tiny recommendation. If you add the “S” it will work on all systems. The other option will not work in some situations.


SendSystemKeys "{win+s}"

Wait 500

SendKeys "Knowbrainer professional 2017"

Wait 200

SendSystemKeys "{Enter}"



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

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

 09/10/2020 10:41 AM
User is offline View Users Profile Print this message

Author Icon
wristofdoom
Top-Tier Member

Posts: 320
Joined: 09/03/2020

Thanks. Can you be more detailed in how to create a DVC script instead of Advanced Scripting?

I go to my Command Browser, and I don't see any commands with this type. I create a new command, and I do not see "DVC" as an option for command type.

My only type of commands are step-by-step, macro, Advanced Scripting, and general text.

 

 



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

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

 09/10/2020 12:33 PM
User is offline View Users Profile Print this message

Author Icon
wristofdoom
Top-Tier Member

Posts: 320
Joined: 09/03/2020

Okay, nevermind, now I see what you mean.

 

I need to modify one of the default "mouse click" type of commands that are built into Dragon.

 

Thanks!



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

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

 09/12/2020 09:05 PM
User is offline View Users Profile Print this message

Author Icon
wristofdoom
Top-Tier Member

Posts: 320
Joined: 09/03/2020

Follow-up question on this...

Do you always need to use "SendSystemKeys" (rather than SendKeys or SendDragonKeys) when you are trying to press the Windows key?

Or is there a way to send the Windows key without resorting to the slower SendSystemKeys command?

 



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

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

 09/12/2020 09:16 PM
User is offline View Users Profile Print this message

Author Icon
dilligence
Top-Tier Member

Posts: 1499
Joined: 08/16/2010

SendSystemKeys is usually more reliable when it comes to using the Windows key as modifier key. Another example of using it would be to access the notification area:

 

SendSystemKeys "{win+b}"

 

There is no real noticeable speed difference when the script is only one line. The rule of thumb is to first try regular SendKeys and if that don't work use SendSystemKeys.



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

https://speechproductivity.eu


Turbocharge your Dragon® productivity with 40 Power Addons

 09/12/2020 09:47 PM
User is offline View Users Profile Print this message

Author Icon
wristofdoom
Top-Tier Member

Posts: 320
Joined: 09/03/2020

Got it, thank you.

 

Under what circumstances would I want to use SendDragonKeys rather than SendKeys or SendSystemKeys?



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

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

 09/12/2020 09:55 PM
User is offline View Users Profile Print this message

Author Icon
MDH
Top-Tier Member

Posts: 2257
Joined: 04/02/2008

"Under what circumstances would I want to use SendDragonKeys rather than SendKeys or SendSystemKeys?"

 

Use SendDragonKeys preferentially using Citrix.

 

MDH



-------------------------
 09/12/2020 10:41 PM
User is offline View Users Profile Print this message

Author Icon
Lunis Orcutt
Top-Tier Member

Posts: 39769
Joined: 10/01/2006

With the release of the DPI 15.6 Download we suspect that SendDragonKeys will no longer hold an advantage over SendKeys but we're also not in a position to test this unproven theory.



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

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

 09/13/2020 07:53 AM
User is offline View Users Profile Print this message

Author Icon
Matt_Chambers
Top-Tier Member

Posts: 550
Joined: 08/09/2018

Originally posted by: Lunis Orcutt With the release of the DPI 15.6 Download we suspect that SendDragonKeys will no longer hold an advantage over SendKeys but we're also not in a position to test this unproven theory.

 

My impression is that SendKeys is now much faster than SendDragonKeys. I did a speed test using a variant of the command that Alan Cantor recommended a few months ago and this is what I got:

SendKeys: 93 ms
SendSystemKeys: 2172 ms
SendDragonKeys: 1250 ms

I'm sure it's not a perfect test, but it's enough to tell me that SendKeys is much faster now.

 11/16/2021 08:50 AM
User is offline View Users Profile Print this message

Author Icon
IceRafter
New Member

Posts: 16
Joined: 01/11/2019

in response to the question under what circumstances to use SendDragonKeys over SendKeys, I generally always use SendDragonKeys due to the consistent XML-tag syntax, e.g.{Ctrl+s} instead of ^s, {Alt+e} instead of %e, {Shift+z} instead of +z, etc. Find it preferable for spitting out equations and formula strings actually containing ^+% characters.

 

Besides being slower than grinding rocks into dirt, a very subtle difference between SendSystemKeys and two alternatives is that it RESPECTS THE STATE OF THE CAPS-LOCK KEY, which CAN be problematic if your target application is case-sensitive. Swear that at some point in the not-too-distant past, SendDragonKeys also respected the state of the caps lock key, but such is not the case today. Verified as much with 15.611.200.010 Dragon build. 

 

Caps lock off Test

 

SendKeys: this should be all lowercase
SendDragonKeys: this should be all lowercase
SendSystemKeys: this should be all lowercase
SendSystemKeys: THIS SHOULD BE ALL UPPERCASE

 

Caps lock on Test

 

SendKeys: this should be all lowercase
SendDragonKeys: this should be all lowercase
SendSystemKeys: THIS SHOULD BE ALL LOWERCASE
SendSystemKeys: this should be all uppercase



-------------------------
Ice Rafter

 11/16/2021 11:09 AM
User is offline View Users Profile Print this message

Author Icon
Matt_Chambers
Top-Tier Member

Posts: 550
Joined: 08/09/2018

Originally posted by: IceRafter in response to the question under what circumstances to use SendDragonKeys over SendKeys, I generally ALWAYS use SendDragonKeys since it does NOT respect the state of the caps lock key. In other words, what you see (in the code window) is what you get (output to the application). in many engineering CAD applications, users prefer to leave caps lock active for most of the session.

 

 

 

Unless Nuance changed the code with the 15.6 release, the output of the SendKeys statement respects the state of the caps lock key, inverting the expected output case-wise if caps lock is active.

 

I just used a SendKeys instruction with the caps lock, and the text came out in lowercase, as the command instructed. I'm using DPI 15.61.

Nuance seemed to improve SendKeys somehow with 15.61. In my experience, SendKeys instructions are now quicker to execute than SendDragonKeys or SendSystemKeys, and nearly as quick as DVC commands.

 11/16/2021 12:45 PM
User is offline View Users Profile Print this message

Author Icon
Lunis Orcutt
Top-Tier Member

Posts: 39769
Joined: 10/01/2006

Nuance seemed to improve SendKeys somehow with 15.61. In my experience, SendKeys instructions are now quicker to execute than SendDragonKeys or SendSystemKeys, and nearly as quick as DVC commands.

 



You are quite right. Nuance finally retired the ancient SAX scripting engine (used in Ver. 15.3) for WinWrap Basic (used in Ver. 15.61), which is what we utilize in KnowBrainer 2020.



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

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



 11/20/2021 03:57 PM
User is offline View Users Profile Print this message

Author Icon
jmcvay
Senior Member

Posts: 154
Joined: 01/02/2015

Interesting discussion about Sendkeys, SendSystemKeys, and SendDragonKeys.

I've been experimenting with Microsoft Voice Typing since upgrading to Windows 11. Despite its many limitations compared to Dragon, it will enter text in fields that Dragon won't.

Here's the interesting part. I can, of course, launch the app by dictating "press Windows H," but I decided to try for less of a mouthfull and wrote a macro containing the line SendKeys "{win+h}". It didn't work. Then I tried SendSystemKeys "{win+h}". That version worked, but it was a little slower than dictating "press Windows H."

I also tried SendDragonKeys "{win+h}", but it didn't work, either.

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

James McVay

 11/20/2021 04:27 PM
User is offline View Users Profile Print this message

Author Icon
Matt_Chambers
Top-Tier Member

Posts: 550
Joined: 08/09/2018

Originally posted by: jmcvay Interesting discussion about Sendkeys, SendSystemKeys, and SendDragonKeys. I've been experimenting with Microsoft Voice Typing since upgrading to Windows 11. Despite its many limitations compared to Dragon, it will enter text in fields that Dragon won't. Here's the interesting part. I can, of course, launch the app by dictating "press Windows H," but I decided to try for less of a mouthfull and wrote a macro containing the line SendKeys "{win+h}". It didn't work. Then I tried SendSystemKeys "{win+h}". That version worked, but it was a little slower than dictating "press Windows H." I also tried SendDragonKeys "{win+h}", but it didn't work, either.

 

If you're using DPI 15.61, try 

SendKeys "{WindowsHold}h"

 11/21/2021 04:08 PM
User is offline View Users Profile Print this message

Author Icon
Lunis Orcutt
Top-Tier Member

Posts: 39769
Joined: 10/01/2006

Matt,

 

SendKeys "{WindowsHold}h" will work in KnowBrainer but unfortunately, not Dragon



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

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

 11/21/2021 04:13 PM
User is offline View Users Profile Print this message

Author Icon
Matt_Chambers
Top-Tier Member

Posts: 550
Joined: 08/09/2018

Originally posted by: Lunis Orcutt Matt,

 

 

 

SendKeys "{WindowsHold}h" will work in KnowBrainer but unfortunately, not Dragon

 

Lunis,

It works for me in DPI 15.61.

Matt

 11/22/2021 11:26 AM
User is offline View Users Profile Print this message

Author Icon
jmcvay
Senior Member

Posts: 154
Joined: 01/02/2015

 

It works for me in DPI 15.61.

 

Matt

 

That works. Thanks, Matt.

By the way, I forgot to mention the main reason I'm experimenting with Microsoft Voice Typing. It accepts dictation in a number of languages other than the few offered by Nuance, including the two I translate from: Russian and Bulgarian.

When I need to translate a scanned PDF file, I can easily look up terms in an online dictionary by dictating them. I still have to switch keyboards to Cyrillic, but I don't have to manually (and laboriously) type the terms. The keyboards for Russian and Bulgarian Cyrillic not only differ markedly from QWERTY, they differ from each other.



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

James McVay

 11/20/2021 04:22 PM
User is offline View Users Profile Print this message

Author Icon
kkkwj
Top-Tier Member

Posts: 865
Joined: 11/05/2015

I think the point of SendSystemKeys is that it can handle the {win} key (and probably other system keys) whereas the others won't. The idea of the system keys is that they have special actions to the system itself rather than just being keys that you can send on to an application. For example, no application will ever see the {win} key in normal operation because the OS eats the {win} key for itself.

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

Win10/11/x64, AMD Ryzen 7 3700X/3950X, 64/128GB RAM, Dragon 15.3, SP 7 Standard, SpeechStart, Office 365, KB 2017, Dragon Capture, Samson Meteor USB Desk Mic, Amazon YUWAKAYI headset, Klim and JUKSTG earbuds with microphones, 3 BenQ 2560x1440 monitors, Microsoft Sculpt Keyboard and fat mouse

 11/21/2021 07:33 PM
User is offline View Users Profile Print this message

Author Icon
Lunis Orcutt
Top-Tier Member

Posts: 39769
Joined: 10/01/2006

Consider me shocked and corrected. I thought this was 1 of the only exceptions between Dragon and KnowBrainer scripts. clearly I should have tested this the 1st time

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

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

 11/22/2021 07:02 AM
User is offline View Users Profile Print this message

Author Icon
Matt_Chambers
Top-Tier Member

Posts: 550
Joined: 08/09/2018

Originally posted by: Lunis Orcutt Consider me shocked and corrected. I thought this was 1 of the only exceptions between Dragon and KnowBrainer scripts. clearly I should have tested this the 1st time

Perhaps the {WindowsHold} functionality came in with the switch to WinWrap Basic, in 15.61?  It's in the WinWrap Basic documentation.  

 12/04/2021 07:08 AM
User is offline View Users Profile Print this message

Author Icon
monkey8
Top-Tier Member

Posts: 3878
Joined: 01/14/2008

Matt is correct in terms of the feature coming with WinWrap Basic. The Windows key functionality was added to WinWrap Basic, especially for KnowBrainer at the time in October 2015 by WinWrap with version v10.30.113, words of WinWrap in blue below. In terms of SendDragonKeys & SendSystemKeys they are extensions to WinWrap Basic implemented by Dragon. 

 

Another significant event in the life of SendKeys was the Windows API methods used with WinWrap Basic. Previously SendKeys was implemented using the Windows Journal Playback Hook but now is implemented using the Windows API function SendInput.

 

"When Microsoft released Vista and UAC the Windows Journal Playback Hook became a privileged API only accessible when UAC is off. That's when WinWrap Basic switched to the SendInput API. I don't have any insight beyond that."

 

 

>>Lindsay,


Okay, I took a couple of hours to revisit the very old code that implements the SendKeys command. I added two new key names {Windows} and {WindowsHold}. {WindowsHold} is a modifier (like %, + and ^) which affects the next key. v10.30.113 has been posted with this enhancement.


E.g. 


SendKeys "{WindowsHold}r" ' Show the run dialog.

SendKeys "{WIndowsHold}^f ' Show the find computers dialog

SendKeys "{Windows}" ' press and release the Windows key.<<



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



 12/05/2021 05:43 PM
User is offline View Users Profile Print this message

Author Icon
kkkwj
Top-Tier Member

Posts: 865
Joined: 11/05/2015

The doc from Microsoft also says that SendKeys can switch between the old delivery method and the new SendInput method. If it can't deliver the preferred way, it apparently switches to another way. My (past) experiences trying to send the Windows key (with SendInput, I think) showed that I could only send particular Win+whatever combinations. Not all combinations are allowed; the os eats them and they never reach the app.

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

Win10/11/x64, AMD Ryzen 7 3700X/3950X, 64/128GB RAM, Dragon 15.3, SP 7 Standard, SpeechStart, Office 365, KB 2017, Dragon Capture, Samson Meteor USB Desk Mic, Amazon YUWAKAYI headset, Klim and JUKSTG earbuds with microphones, 3 BenQ 2560x1440 monitors, Microsoft Sculpt Keyboard and fat mouse

 12/08/2021 10:51 AM
User is offline View Users Profile Print this message

Author Icon
monkey8
Top-Tier Member

Posts: 3878
Joined: 01/14/2008

Which Microsoft document would that be? WinWrap basic implements SendKeys using SendInput and simply doesn't miss a beat either sending the Windows key on its own or in a combination, it never switches to alternative methods. I also have my own C# & C++ implementation of sendinput and again is 100% reliable. It was a replacement for the keyboard and mouse event APIs as well as to overcome journal playback issues although they are still accessible.

 

I would find hard to believe that Windows messaging swallows sendinput messages unless the implementation of SendInput is less than perfect.Otherwise you will probably find that it is a firewall or other Guard software that prevents sending keystrokes using SendInput

 

https://social.msdn.microsoft.com/Forums/netframework/en-US/a436bd4d-4d88-44ee-8646-97e2838fcefd/is-sendinput-api-safe-to-use?forum=vclanguage



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



 02/19/2022 06:09 PM
User is offline View Users Profile Print this message

Author Icon
wristofdoom
Top-Tier Member

Posts: 320
Joined: 09/03/2020


I'm trying to make use of {windows} hold in combination with arrow keys to move windows around my monitors.

But it's not working. The code I have here should emulate pressing Windows key + right or left arrow key 5 times (which is enough to move the current window over to another monitor), followed by Windows + up arrow (to fullscreen the window).

It's not working, however. My code: https://pastebin.com/Xkd8MeAn

I don't want to get into using slow SendSystemKeys or DVC, I want to understand how {windowshold} is supposed to work.

Any ideas?



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

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



 02/19/2022 07:53 PM
User is offline View Users Profile Print this message


Alan Cantor
Top-Tier Member

Posts: 4280
Joined: 12/08/2007

I don't think you'll notice the speed difference. A single, simple SendSystemkeys instruction should run quite fast.
Statistics
32285 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 392 guests browsing this forum, which makes a total of 392 users using this forum.

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