'程序说明:打开WORD,切换成英文输入法,切换成大写状态,输入英文字母,存盘,然后关闭WORD,接着把刚才存盘的文档移到C盘。
'下面是源码:
Set wshobj=WScript.CreateObject("WScript.Shell")
app=wshobj.Run ("winword.exe") '打开WORD
WScript.Sleep 1000
wshobj.AppActivate app '激活当前窗口
WScript.Sleep 1000
wshobj.SendKeys "^ " '切换成英文输入法
wshobj.SendKeys "{CAPSLOCK}" '切换成大写
wshobj.SendKeys "ABCDEFG"
WScript.Sleep 1000
wshobj.SendKeys "{CAPSLOCK}" '切换成小写
WScript.Sleep 1000
wshobj.SendKeys "^s" '另存为
WScript.Sleep 1000
wshobj.SendKeys "d:\aaa.doc" '输入存盘路径
WScript.Sleep 2000
wshobj.SendKeys "{ENTER}"
WScript.Sleep 1000
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'winword.exe'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next
wshobj.Run "C:\WINDOWS\system32\cmd.exe",1,False
WScript.Sleep 1000
wshobj.AppActivate "C:\WINDOWS\system32\cmd.exe"
wshobj.SendKeys "move d:\aaa.doc c:\"
WScript.Sleep 1000
wshobj.SendKeys "{ENTER}"
WScript.Sleep 1000
wshobj.SendKeys "EXIT"
WScript.Sleep 1000
wshobj.SendKeys "{ENTER}"
Wscript.Quit