Running a Script

To run a script from the Project Manager:

  1. In the Project Manager Definitions > Scripts folder, right-click on the script you want to run to open the context menu.
  2. Select Run Script.

To run a script from Maxwell:

  1. Click Tools > Run Script.
  2. In the Open dialog box that appears, use the file browser to locate the folder in which you saved the script, and then double-click the folder's name.
  3. Type the name of the script in the File name text box, or click its name, and then click Open.
    Maxwell executes the script.
Note: To supply script arguments when running from Tools > Run Script, use the edit field at the bottom of the file selection dialog box. You can access the script arguments using the AnsoftScriptHost.arguments collection from vbscript. This is a standard COM collection.

To run a script form a command line:

  1. Type one of the following command line options at the command line:

-runscriptandexit or -runscript

  1. Press Enter.

You can also pass the -scriptargs parameter to the script and specify arguments.

Note: If you run the script from DOS prompt as a .vbs file (that is, you do not launch Maxwell, but launch vbs directly, or use wscript.exe or cscript.exe), the arguments will be in the WSH.arguments collection, not the AnsoftScriptHost.arguments collection. To handle this, write the following:

on error resume next

dim args

Set args = AnsoftScript.arguments

if(IsEmpty(args)) then

Set args = WSH.arguments

End if

on error goto 0

'At this point, args has the arguments no matter if you are running

'under windows script host or Ansoft script host

msgbox "Count is " & args.Countfor i = 0 to args.Count - 1

msgbox args(i)

next