Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.5k views
in Technique[技术] by (71.8m points)

windows - VBScript SendKeys CTRL+LWIN+TAB?

I am trying to write a simple script that will send the key combo of CTRL+WINDOWS KEY+TAB. The code below sends the keys CTRL+ALT+TAB

Set WshShell = WScript.CreateObject("WScript.Shell")
  WshShell.SendKeys "^%{TAB}"

However when I try to replace "%" (aka the ALT key) with LWIN (aka the Left Windows Key) it says Syntax Error.

I tried the following, but had no luck:

Set WshShell = WScript.CreateObject("WScript.Shell")
  WshShell.SendKeys "^{LWIN}{TAB}"

 

Set WshShell = WScript.CreateObject("WScript.Shell")
  WshShell.SendKeys "^{LWIN}+{TAB}"

 

Set WshShell = WScript.CreateObject("WScript.Shell")
  WshShell.SendKeys ^{LWIN}+{TAB}

I know it has something to do with being able to Hold certain keys while other keys are pressed but I can't seem to get it right.

The windows key can be pressed programmatically using CTRL+ESC. Is there a way to set this combination as a variable called LWIN and then use one of the above Scripts?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

try this code:

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.SendKeys "+(^{LWIN}{TAB})"

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...