No, WScript is available only when script runs with wscript.exe or
cscript.exe. You can not know in COM/.Net object how program was started -
it could be script, .Net or C++ program, ASP or ASP.Net page or anything
else.
You can not create instance of WScript object, it is created automatically
in wscript.exe or cscript.exe.
You could pass this values (or even WScript object itself) from script
itself to your object (create property in .Net object and assign WScript
object to this property in script). But be ready that some script (or other
caller) will not pass these values into your object.
//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)
"Alek Davis" <alek_xDOTx_davis_xATx_intel_xDOTx_com> сообщил/сообщила в
новостях следующее: news:(E-Mail Removed)...
> Hi,
>
> Is it possible to access intrinsic WScript object properties from a .NET
> class? I am writing a COM object in .NET (VB.NET or C#), which can be
> invoked from a WSH script (VBS, JS, etc). In the COM object logic, I have
to
> detect such properties as Interactive, ScriptFullName, and others. I can
get
> some of these properties through the .NET Framework equivalents, but some
> properties are only available from WScript object. I thought that I could
> get them through the IHost interface of the WScript.exe (I added it as a
> reference), but I cannot figure out how to instantiate the IHost object. I
> tried to create as:
>
> IHost.IHost iHost = new IHost.IHost_ClassClass();
>
> but got the error:
>
> "COM object with CLSID {60254CA2-953B-11CF-8C96-00AA00B8708C} is either
not
> valid or not registered."
>
> Any ideas? Thanks,
>
> Alek
>
> P.S. Sorry for cross-posting. I tried the Interop group but did not get
any
> responses.
>
>