当我运行下面的VB脚本时,我会按预期获得所需的输出。
但是,运行了一个新的winword.exe进程,我想在脚本结束后终止它。
Set Wshshell= CreateObject("Word.Basic")
WshShell.sendkeys"%{prtsc}"
WScript.Sleep 1500
Set wshshell = Nothing
set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "mspaint"
WScript.Sleep 1000
Set wshshell = Nothing
Set Wshshell= CreateObject("Word.Basic")
WshShell.AppActivate "Paint"
WScript.Sleep 2000
WshShell.sendkeys"^(v)"
WScript.Sleep 1000
WshShell.sendkeys"^(s)"
WScript.Sleep 1500
WshShell.sendkeys"c:\testing.jpg"
WScript.Sleep 500
WshShell.sendkeys "{Enter}"
Set wshshell = Nothing
答案 0 :(得分:2)
您必须使用
关闭活动进程Wshshell.FileClose
或
Wshshell.AppClose