Scripting an Object

In order to use most components, you must create a script to control the object. Mathcad comes with a Script Editor, where you can write and maintain the script for each scripted object in your worksheet.

  1. To launch the Script Editor, right-click on the object you want to script and choose Edit Script.
  2. When you are done editing the script, select Close & Return from the File menu to save the script and return to the worksheet.

You can also save scripts for reuse with other scripted objects. Select Export from the File menu to save a copy of the script to disk. To use a saved script in a component, select Import from the File menu. When you import a script, check that the object name in the script matches the object name in the worksheet.

Structure of a Script

There are three required parts to each script, called event handlers. These three event handlers are called in sequence every time a component calculates.

For more specific information on how to script objects and Mathsoft Controls, see the Developer's Reference under the Help menu. Regardless of which scripting language you use, your script must contain these three event handlers. You can use other event handlers if you wish, but they are not required. A basic framework containing these event handlers is preloaded for any new scriptable component you create.

Note:

QuickSheet

Related Topics