最小化所有窗口:
Set obj = CreateObject("Shell.Application")
obj.MinimizeAll
最小化某窗口:
Const strTitle = "完整的窗口标题"
Dim objShell
Set objShell = CreateObject("Wscript.Shell")
While True
If objShell.AppActivate(strTitle) Then
Wscript.Sleep 250
objShell.SendKeys "% "
objShell.SendKeys "n"
Set objShell = Nothing
Wscript.Quit
End If
Wend
(该vbs会一直检测指定窗口是否打开,直到检测到,并将其关闭)
(如果想执行一次,去掉循环结构即可)
直接运行系统的某些工具
dim wsh
set wsh=createobject("wscript.shell")
wsh.Run "control"
VBSendkeys如何用sendkeys模拟按下组合键
Ctrl+Alt+A SendKeys"^%A"
Alt+F SendKeys"%{F}"
右键窗口 Sendkeys "% " (上面最小化的例子)
参考链接:http://www.zhishizhan.net/doc-2760X4443b45d7f158d30.html (包含各种sendkeys问题)
指定某窗口并输入按键:
dim wsh
set wsh=createobject("wscript.shell")
wscript.sleep 50
wsh.AppActivate("test.txt - Notepad")
wsh.sendKeys "{ENTER}"
按键参考:
链接:http://www.jb51.net/article/4201.htm
用VBS控制鼠标的实现代码(获取鼠标坐标、鼠标移动、鼠标单击、鼠标双击、、、
链接:http://www.jb51.net/article/28692.htm
Windows 键盘基本操作
链接:http://zhidao.baidu.com/question/84441614.html
vbs基础篇
链接:http://www.cnblogs.com/sirrah/category/354555.html
sendkeys 链接:http://www.cnblogs.com/sirrah/articles/2348988.html