使用键盘和鼠标锁运行的vbs脚本

时间:2018-03-14 11:31:26

标签: vbscript

我在下面创建的脚本打开了许多虚拟机,同时脚本运行本地计算机的键盘,鼠标通过脚本CTRL ALT + F的短按键条目锁定。当脚本完成时,我会像键盘和鼠标一样使用相同的功能解锁。

请注意,即使键盘已锁定,解锁键盘和鼠标的热键仍处于活动状态,这些键都是CTRL ALT + F.

脚本运行完美,但没有解锁键盘和鼠标,请问任何人都可以看到此脚本的任何问题吗?

Dim shell
Set shell = wscript.CreateObject("Shell.Application")
    set x = CreateObject("Wscript.shell")
    x.sendkeys("^%{f}")
shell.Open "C:\Program Files\Oracle\VirtualBox\VirtualBox.exe"
WScript.Sleep 3000
shell.Open 
"\\leeds.smoothwall.net\DFS\homefolder\steve.newton\Documents\Local 
Automation scripts\VBS files\Paths\NetworkGuardian.lnk"
WScript.Sleep 120000
shell.Open 
"\\leeds.smoothwall.net\DFS\homefolder\steve.newton\Documents\Local 
Automation scripts\VBS files\Paths\IE11 - Win10 Admin.lnk"
WScript.Sleep 20000
shell.Open 
"\\leeds.smoothwall.net\DFS\homefolder\steve.newton\Documents\Local 
Automation scripts\VBS files\Paths\IE11 - Win10.lnk"
WScript.Sleep 20000
Set shell = wscript.CreateObject("Shell.Application")
    set x = CreateObject("Wscript.shell")
    x.sendkeys("^%{f}")
WScript.Sleep 2000
    MsgBox "Automation Startup complete"

1 个答案:

答案 0 :(得分:0)

我找到了解决方案,当虚拟机启动时,它们会自动将用户控件发送到活动窗口,我关闭了此选项,现在脚本运行正常。

相关问题