Evaluates a JScript expression.
<eval
code="expression" />
Attributes
code
A string of valid JScript code. For example, "foo()" evaluates the global function foo.
Remarks
Use the Script element to make custom JScript available for use with the eval statement.
If the eval statement is a task rule, the expression is evaluated when the rule is processed as part of an event. Using eval in this context allows:
custom code to determine the status of a task
the task to perform any arbitrary operation
The file MechanicalWizard\WDK\Tools_Merge.xml demonstrates use of the eval statement to:
Execute global functions defined in a script file referenced by a Script element.
Access the DOM to manipulate the DHTML page containing the wizard.
Call methods on global objects to automate the Mechanical Wizard.
If the eval statement exists inside of a body or group element, the expression evaluates at that point in the generation of the wizard DHTML. Using eval in this context allows for programmatically generating wizard content. See Startup.xml, New.xml and InsertGeometry.xml in the MechanicalWizard\Panels folder for examples. These examples call global functions defined in the script file MechanicalWizard\System\PanelFunctions.js.
Complete coverage of scripting is beyond the present scope of this documentation. You may use the source code as a reference and a script debugger for exploring variables and object models. The following globally-available JScript objects are particularly useful:
g_Wizard - the global Wizard object that controls the Mechanical Wizard. Defined in MechanicalWizard\System\WizardObject.js.
g_Wizard.App - provides access to the key objects in the Mechanical application and Ansys Workbench. Defined in MechanicalWizard\System\AppObject.js.
g_Wizard.App.Scripting - reference to the script block inside the Mechanical application.
g_Wizard.GlobalStrings - a Strings object (StringLookupObject.js) containing generic strings defined in MechanicalWizard\Data\GlobalStrings.xml.
g_Wizard.Strings - a Strings object containing strings from the loaded TaskML document.
Element Information
Parents | As an action or condition: activate-event, update-event, if, and, or, not, then, else For evaluation as the wizard loads: body, group |
Children | None |
End Tag | No - close element with "/>" |
Return Value | Return value of the expression or null. |