Board logo

标题: 为什么我的vbs脚本在我系统不能实现待机 [打印本页]

作者: yufalai     时间: 2009-6-4 08:14    标题: 为什么我的vbs脚本在我系统不能实现待机

set WshShell = CreateObject("WScript.Shell")
WshShell.SendKeys "^{ESC}u"
WshShell.SendKeys "S"
在以前的系统可以
现在不能
作者: slore     时间: 2009-6-4 11:44
开始菜单上有S开头的?
还是要小写s?



用VBS的话打开对话框还是不要用sendkeys



Dim ShellApp,WshShell
Set WshShell = CreateObject("WScript.Shell")
Set ShellApp = CreateObject("Shell.Application")
ShellApp.ShutdownWindows()
WshShell.Sendkeys "s"
作者: wl00560     时间: 2009-6-4 12:26
你文件的意思是:启动开始菜单,然后再按u与s……
这个在Windows XP下没问题,可是别的系统就不见得是这些键了,如Windows Server 2003……
作者: yufalai     时间: 2009-6-5 00:36
我现在用的也是xp
开始菜单是一样的
就是不能用
具体是能 按出win键 但是u键就没有按出来
作者: yufalai     时间: 2009-6-5 00:41
2楼的能执行win键+u键
但是没有执行s
作者: slore     时间: 2009-6-5 01:08
2楼的能执行win键+u键

不是执行win+U
是直接调用了关机对话框
我随便写的。。。
这个我有不能试。。。

S可以么?
或者是需要延时下。。。sendkeys太快了?你的对话框还没有出来?


alt+s
sendkeys 怎么表示alt忘了,你自己查下。
。。。
作者: yufalai     时间: 2009-6-5 03:00
就是s没执行
delay也不行
作者: slore     时间: 2009-6-5 16:55
你查下 alt+S。。。
作者: slore     时间: 2009-6-6 01:58    标题: 测试成功

Dim ShellApp,WshShell
Set WshShell = CreateObject("WScript.Shell")
Set ShellApp = CreateObject("Shell.Application")
ShellApp.ShutdownWindows()
WSH.Sleep 1000 '延时1秒
WshShell.Sendkeys "s"
作者: yufalai     时间: 2009-6-9 12:41
thank you very much!