0

当我运行下面的 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
4

1 回答 1

2

您将不得不使用关闭活动进程

Wshshell.FileClose 

或者

Wshshell.AppClose
于 2013-05-05T16:40:12.370 回答