开发者

vbscript SendKey

开发者 https://www.devze.com 2023-01-13 15:07 出处:网络
I have a process I need to run which can only be run by shortcut keys which are CTRL+ALT+RIGHT SHIFT To make it easier for users I would like to create a desktop shortcut to click on to run this shor

I have a process I need to run which can only be run by shortcut keys which are CTRL+ALT+RIGHT SHIFT

To make it easier for users I would like to create a desktop shortcut to click on to run this shortcut.

The way I thought this could be done is by vbs script sendkey.

Am I right in my research to say that right shift key can not be specified?

I know there is ^% for 开发者_运维技巧CTRL and ALT and + for generic shift but that does not work for right shift.

Is there a way for me to do this?


I recommend that you use AutoHotkey.

It has a very robust, proven "sendkey" functionality, including the ability to send right shift.

Your script would simply be:

SendInput,^!{RSHIFT}

Furthermore, it comes with a utility that will compile the script into a .exe, which is what you'd want to use on the desktop.


I use my own open source software "sendkeys v0.0.1" for this. You can compile it as a C# console application in Visual Studio 2013.

Source: Sendkey v0.0.1

Then use it in a command window like this:

 Sendkey CONTROL down
 Sendkey MENU down
 Sendkey RSHIFT down
 Sendkey CONTROL up
 Sendkey MENU up
 Sendkey RSHIFT up

Or in vbscript using the .Exec() method.

(N.B. command window is Microsoft slang for 'terminal' or 'console')

0

精彩评论

暂无评论...
验证码 换一张
取 消