How to enter "Windows" keystroke sequence in SendKeys command?
Submitted by voicedictation on Tue, 09/27/2005 - 14:48.
Hello,
How do I send a keystroke sequence containing the special "Windows" key pressed in combination with another key, such as "Windows_key + c" in a Sendkeys command? The online help doesn't list the name of the "Windows key".
Thanks, John.

voicedictation
Hello,
How do I send a keystroke sequence containing the special "Windows" key pressed in combination with another key, such as "Windows_key + c" in a Sendkeys command? The online help doesn't list the name of the "Windows key".
Thanks, John.
John,
The Windows key is just a combo key (i.e., it is not really a unique key on the keyboard because there are only 101 possible keys even if your keyboard has more than 101 physical keys). For example the following:
SendSystemKeys "{Ctrl+Esc}"
brings up the Start menu the same as the Windows key. I use the SendSystemKeys because they are generally easier to configure and more reliable when using these types of keystroke functions.
The question is where do you want to go from there. adding {c} to the keystroke sequence will get you to the first listing in the Start menu beginning with "c" or "C". However, if you have multiple entries with "C" or "c", you may not get where you want to be. In short, the hotkeys in the Start menu are not only those with underscores, all items "Pinned" to the Start menu are also more or less hotkeyed to their first character.
So, you should try the keyboard keystrokes to see where they take you, then add the approriate SendSystemKeys command. For example, if I want to go the the control pannel, I would use: SendSystemKeys "{Ctrl+Esc}{c 3} because it takes pressing the "C" key 3 times to get to the Control Pannel option in my Start menu.
You can also use the Step-by-Step macro function.
If I knew exactly what you were trying to do, I could be more specific. However, basically the Windows key is the Ctrl key plus the Esc key.
On the other hand, I don't understand why you're reinventing the wheel. It is just as easy to simply say "Start" and then say any item in the Start menu. As long as it has an underlying hotkey assigned (visible or otherwise) that's all you have to do. It generally takes you about 10 times longer to create the macro that it does to simply say it, and simply saying these commands executes immediately and generally slightly faster than the macro.
Chuck
Ah, yes. I knew that, but
Ah, yes. I knew that, but had forgotten that it is equivalent to Ctrl plus the Esc key. Thanks for reminding me of this. The reason I asked is because a s/w application uses a keyboard shortcut (of Windows key plus "c", or Ctrl+Esc+c).
Thanks again. John
Let me get this straight. In
Let me get this straight.
In order to hold down the 'windows key' and press the 'c' key the Sendkeys syntax would be:
SendKeys "{Ctrl+Esc+c}"?
I think I tried that some time ago without success.
-Sean
Sean Wenzel wrote:Let me get
Let me get this straight.
In order to hold down the 'windows key' and press the 'c' key the Sendkeys syntax would be:
SendKeys "{Ctrl+Esc+c}"?
I think I tried that some time ago without success.
-Sean
Sean,
SendKeys is unreliable and a pain in the you know what. Use SendSystemKeys. More reliable and works better. Also, Ctrl+Esc+c doesn't work for the reasons that I indicated. You need to count the number of items listed in the Start menu that begin with 'C', particularly those that are pinned to the Start menu because these are executed by pressing 'c' in the order they occur top-down/left-right.
Chuck
Chuck
Just realized that I should
Just realized that I should have written SendSystemKeys and not SendKeys. Thanks for the pointing this out.
I don't believe we are trying to access the start menu at all here (at least I'm not). There are some applications that use Windows Key + key for some keyboard shortcuts. Wish I could remember the specific application I found this in.
That is. Hold down the Windows key. Press another key. Release both keys. Just like Ctrl/Alt or Shift.
eg.
SendSystemKeys("{Ctrl+Esc+c}")
instead of
SendSystemKeys("{Ctrl+Esc}c")
which accesses the start menu. (Brings up Control Panel in my case)
Although I don't think the first one actually works or really makes sense.
I believe that I ended up working around the issue at the time by creating a mouse macro to avoid the use of the Windows logo key in the script.
-Sean
Sean Wenzel wrote:Just
Just realized that I should have written SendSystemKeys and not SendKeys. Thanks for the pointing this out.
I don't believe we are trying to access the start menu at all here (at least I'm not). There are some applications that use Windows Key + key for some keyboard shortcuts. Wish I could remember the specific application I found this in.
That is. Hold down the Windows key. Press another key. Release both keys. Just like Ctrl/Alt or Shift.
Sean,
That's what I was trying to do (i.e., access the Control Panel). However, as I said in my previous response, this only works if you have no other items “Pinned” to start menu. Otherwise, it has to be written as such:
SendSystemKeys "{Ctrl+Esc}{c}" (this is the correct syntax)
Otherwise, your version only gets you to the first “pinned” entry in the Start menu, and not to the Control Panel. If you have, as I do, 2 entries on the left side of the Start menu that begin with the letter 'c', then getting the control panel requires the following:
SendSystemKeys "{Ctrl+Esc}{c 3}"
In addition, if you have your control panel displayed as a list, as I do, it has to be written as follows:
SendSystemKeys "{Ctrl+Esc}{c 3}{Enter}"
SendSystemKeys("{Ctrl+Esc+c}")
instead of
SendSystemKeys("{Ctrl+Esc}c")
which accesses the start menu. (Brings up Control Panel in my case)
Although I don't think the first one actually works or really makes sense.
In your case, what you cite above may work for you, but only because it seems apparent that you are going directly to the folder view, or classic view.
By the same token, pressing and holding the Windows key while pressing a shortcut key may work with the Windows key, but it doesn't work with pressing and holding Ctrl + ESC, and then pressing a shortcut key. You have to press Ctrl + ESC and release, then press a shortcut key.
I believe that I ended up working around the issue at the time by creating a mouse macro to avoid the use of the Windows logo key in the script.
-Sean
I still say that it's overkill to create a macro to do this when it is just as fast to say “Start” then “Control Panel”. It always completely amazes me that after 5 versions of Dragon NaturallySpeaking®, users still do not use the full power of "Say What You See". I see this with other very powerful commands as well. Users spend all of their time writing unnecessary macros.
Chuck
Chuck, the Windows key has a
Chuck, the Windows key has a lot more uses other than than simply bringing up the start menu. Win-e brings up an explorer, Win-r opens the run menu, Win-d brings up the desktop, Win-l locks the computer and so on. It's definitely not not the same thing as Ctrl-Esc+<key>, which as you mention isn't needed anyway. The 101 key limitation may have existed back in the day, but Windows XP supports 254 keys including LWIN, RWIN, LAUNCH_MAIL, MEDIA_STOP among others.
But to answer the original question, I don't think it's possible using NaturallySpeaking's native capabilities.
I started working on a DLL which would uses SendInput to simulate Win-<key>
Update: you can find this DLL at http://speechwiki.org/SR/WindowsKey.html
-- Scott W
Speech resources at SpeechWiki
Products at Applied Recognition
ScottW wrote:Chuck, the
Chuck, the Windows key has a lot more uses other than than simply bringing up the start menu. Win-e brings up an explorer, Win-r opens the run menu, Win-d brings up the desktop, Win-l locks the computer and so on. It's definitely not not the same thing as Ctrl-Esc+<key>, which as you mention isn't needed anyway. The 101 key limitation may have existed back in the day, but Windows XP supports 254 keys including LWIN, RWIN, LAUNCH_MAIL, MEDIA_STOP among others.
But to answer the original question, I don't think it's possible using NaturallySpeaking's native capabilities.
I started working on a DLL which would uses SendInput to simulate Win-<key>
Update: you can find this DLL at http://speechwiki.org/SR/WindowsKey.html
-- Scott W
Speech resources at SpeechWiki
Products at Applied Recognition
Scott,
Agreed. However, it was not my intention to go that deep into what is transmitted to the "console" and how new keys send keystroke info.
I am not sure what you mean by saying that DNS does not support these directly via the native interface. However, from an Advanced Scripting standpoint, your DLL approach is obviously the best way to do this. Nevertheless, I don't generally assume that persons posting fully understand some of the more advanced commands for Advanced Scripting.
Actually, you can map any key on the keyboard using "Keystroke" in the Step-by-Step macro function. While some multiple keystrokes need to be entered on separate lines, as long as you don't create a long step-by-step macro, these execute almost as fast as Advanced Scripting macros and take considerably lest time and know-how to create. For example, to build a step-by-step macro using the Windows key to access the Control Panel, you select insert keystroke and press the Windows key, then insert keystroke again and press the 'c' key. What you end up with is:
Press Windows
Press C
Give it an appropriate voice command and it works just fine. The only difference between this and an Advanced Scripting macro to accomplish the same task is about 1 to 2 ms. You can use the step-by-step macros to perform any similar keystroke function depending upon the keys available on your keyboard. The step-by-step macros recognize all keys, even the special keys to which you refer.
My point is simply this, why get in your limousine to just to go to the mailbox. Or, if ain't broke, don't fix it, and if it doesn't work, plug it in. Your advice and counsel is well-respected by me and others on this forum. However, I have been trying for over 6 years to get users to understand that it isn't absolutely necessary to wrap your leg around your neck to perform functions in DNS that can be done very simply by using the built-in capabilities with regard to both scripting and the extensive set of commands, particularly Say What You See, that can accomplish many of the tasks that users need to do simply and without an extensive knowledge of Advanced Scripting.
Chuck
> I am not sure what you
> I am not sure what you mean by saying that DNS does not support these directly via the native interface
I suppose I just meant that the advanced scripting Send*Keys() functions don't support this key, and that you cannot say for example "press key Windows f". Until you told us, I wasn't aware that the step-by-step macros supported the Windows Key. Thanks for the new info.
-- Scott W
Speech resources at SpeechWiki
Products at Applied Recognition
ScottW wrote:> I am not sure
> I am not sure what you mean by saying that DNS does not support these directly via the native interface
I suppose I just meant that the advanced scripting Send*Keys() functions don't support this key, and that you cannot say for example "press key Windows f". Until you told us, I wasn't aware that the step-by-step macros supported the Windows Key. Thanks for the new info.
-- Scott W
Speech resources at SpeechWiki
Products at Applied Recognition
Scott,
I have not tried it. However, it might be interesting to attempt the following.
Use Step-by-Step and use the insert Keystroke. Press a key you want (e.g., Windows, etc.) and see the name that it grabs. Try putting that into a SendKeys. May work, may not, but I am sure that Step-by-Step grabs the keystroke from "console" output. If this is correct, then, in theory, it should work. Note that these should be treated as non-printing keystrokes. Don't have time to do it myself, but if you do, let us know whether it works.
Chuck
You raise some excellent
You raise some excellent points. We all seem to agree that it's just as fast to say the commands to access the Control Panel.
To get back on topic...
We are _not_ trying to access the Control Panel. We are trying to send a Windows Logo+anykey to the active running application, whatever it may be.
The answer seems to be No, DNS cannot send a WindowsLogo+key. It can only simulate a single press of the Windows Logo key which is the same as Ctrl+Esc.
There may be a workaround set of keystrokes for the specific application.
Failing that the only option would be to call an external function in a DLL as suggested elsewhere in this thread.
Sean Wenzel wrote:You raise
You raise some excellent points. We all seem to agree that it's just as fast to say the commands to access the Control Panel.
To get back on topic...
We are _not_ trying to access the Control Panel. We are trying to send a Windows Logo+anykey to the active running application, whatever it may be.
The answer seems to be No, DNS cannot send a WindowsLogo+key. It can only simulate a single press of the Windows Logo key which is the same as Ctrl+Esc.
There may be a workaround set of keystrokes for the specific application.
Failing that the only option would be to call an external function in a DLL as suggested elsewhere in this thread.
Sean,
Did you review my previous post (relevant section below):
Actually, you can map any key on the keyboard using "Keystroke" in the Step-by-Step macro function. While some multiple keystrokes need to be entered on separate lines, as long as you don't create a long step-by-step macro, these execute almost as fast as Advanced Scripting macros and take considerably lest time and know-how to create. For example, to build a step-by-step macro using the Windows key to access the Control Panel, you select insert keystroke and press the Windows key, then insert keystroke again and press the 'c' key. What you end up with is:
Press Windows
Press C
Give it an appropriate voice command and it works just fine. The only difference between this and an Advanced Scripting macro to accomplish the same task is about 1 to 2 ms. You can use the step-by-step macros to perform any similar keystroke function depending upon the keys available on your keyboard. The step-by-step macros recognize all keys, even the special keys to which you refer.
If you have multiple keystrokes following the Window key, this is a bit tedious because you need to create multiple Step-by-Step macros, but these are quite easy to do, and if you want to limit where they execute, simply make it application or window specific as needed. I have done some pretty simple but very fast and functional macros this way.
Chuck