codegoboom
04-19-2005, 06:21 AM
Syntax is just about identical:
JScript Function:
GetObject([pathname] [, class])
WSH Method:
WScript.GetObject(strPathname [,strProgID], [strPrefix])
The first two parameters for each are described as being the same...
I'd like to use the third parameter of GetObject to hook events, but can't, because 'WScript.GetObject' fails:
try
{
var jsComponent = GetObject("script:c:\\test.wsc");
WScript.Echo(typeof jsComponent); // -> object
var wsComponent = WScript.GetObject("script:c:\\test.wsc"); // -> throws error
WScript.Echo(typeof wsComponent);
}
catch(e)
{
WScript.Echo("Hello Failure!"); // -> no real error message available...
}
Whether or not the "script:" moniker is used, the WSH method fails. (The JS function returns "unknown" without the moniker...)
Is it just me? :confused:
JScript Function:
GetObject([pathname] [, class])
WSH Method:
WScript.GetObject(strPathname [,strProgID], [strPrefix])
The first two parameters for each are described as being the same...
I'd like to use the third parameter of GetObject to hook events, but can't, because 'WScript.GetObject' fails:
try
{
var jsComponent = GetObject("script:c:\\test.wsc");
WScript.Echo(typeof jsComponent); // -> object
var wsComponent = WScript.GetObject("script:c:\\test.wsc"); // -> throws error
WScript.Echo(typeof wsComponent);
}
catch(e)
{
WScript.Echo("Hello Failure!"); // -> no real error message available...
}
Whether or not the "script:" moniker is used, the WSH method fails. (The JS function returns "unknown" without the moniker...)
Is it just me? :confused: