How to use Wscript in Directory Opus CLI?


I opened Directory Opus CLI and try:

MsgBox Wscript.Name

I got error, that I need Wscript object.


Best regards,

Opus provides its own environment for scripts to run in; it doesn't use WSH and so the WScript object isn't available.

You can usually do most things using the methods that Opus itself provides though, and you can create other ActiveX objects using the CreateObject method.

Please tell me how to create WScript object using CreateObject method. Its for studing purpose.

I don't think the WScript object can be created. It's provided by the Windows Scripting Host, but Opus doesn't use that.

What is it you're trying to do?

I've been just started to learn VBScirpt and have been decided to play with WScript now.

I created one button I needed some days ago, but this took me a lot of time.

It doesn't sound like you want to do this in Opus at all then. You can use the cscript.exe DOS command to run scripts under WSH, and the WScript object will be available there.

It seems to me I used wscript in code for my button. I will look my code this everning.

You can create some of the WSH objects within the Opus scripting environment, but they won't be created automatically for you like under wscript.exe or cscript.exe (as they are usually not needed).

But if you want to show a message box from an Opus script, you should use the Dialog object which Opus provides, not the WScript MsgBox function.

OTOH, if you don't want to run the script from inside of Opus, then there's no reason to be using the Opus CLI to write the script at all.