該事件在遠(yuǎn)程腳本出錯(cuò)時(shí)引發(fā)。
Object_Error
當(dāng)遠(yuǎn)程腳本過早終止時(shí),遠(yuǎn)程腳本對(duì)象會(huì)引發(fā) Error 事件。Error 屬性中包含 WshRemoteError 對(duì)象(該對(duì)象帶有有關(guān)導(dǎo)致遠(yuǎn)程腳本過早終止的錯(cuò)誤的信息)。
var WshController = new ActiveXObject("WSHController");
var RemoteProc = WshController.CreateScript("foo.wsf", "remotemachine");
WScript.ConnectObject(RemoteProc, "RemoteProc_");
var Done = false;
RemoteProc.Execute();
while (!Done)
WScript.Sleep(100);
function RemoteProc_End()
{
WScript.Echo("The process has ended");
Done = true;
}
function RemoteProc_Error()
{
WScript.Echo("An error has occurred:" + RemoteProc.Error.Description);
Done = true;
}
function RemoteProc_Start()
{
WScript.Echo("The process has started");
}
WshController 對(duì)象 | WshRemote 對(duì)象 | WshRemoteError 對(duì)象 | Status 屬性 | Error 屬性 | Execute 方法 | Terminate 方法 | Start 事件 | End 事件