Advanced Controls Options
Enabling and Disabling Advanced Controls
To alert and protect users against potentially harmful code, PTC Mathcad Prime issues a warning message every time you attempt to open a worksheet that contains advanced controls. If you open a worksheet containing advanced controls that you know to be safe, click Yes when the warning box is displayed. Clicking Yes enables all the controls in the worksheet. If you click No, the advanced controls are disabled and the script is not functional. In this case, you can still access the Script Editor tab to make changes to the script, but the Properties tab remains disabled. If you apply the changes, the script does not run.
If you initially choose No but want to enable the advanced controls later, follow these steps:
1. In the worksheet, select the controls you want to enable.
2. Right-click the control and select Enable Region. Alternatively, go to the Calculation tab and Select Disable Region.
If you want to hide the warning permanently, click > and select Hide Advanced Controls warning.
Configuring Advanced Controls Recalculation
By default, advanced controls scripts are not executed when opening or recalculating the worksheet, nor when copying and pasting a control. The scripts run when interacting with the control (e.g. changing a selection or clicking a button). The control retains the data saved in the worksheet. However, once the script runs, the data may change or be erased depending on the script logic, and the control presents the updated data.
To configure the events that trigger the execution of the scripts, click > and select Run Advanced Control script on worksheet open or Run Advanced Control script on worksheet recalculate. You can also enable both options, this may cause a performance decrease.
Depending on the script, the control may change or erase the data it was saved with under the following conditions:
• When Run Advanced Control script on worksheet open is enabled—the script runs when the worksheet is opened.
• When Run Advanced Control script on worksheet recalculate is enabled—the script runs when clicking on Calculate Worksheet.
• Each time you change inputs or interact with the control, regardless of the control’s options settings.
Setting Python as a Scripting Environment for Advanced Controls
Advanced controls support VBScript, JScript and Python. Using VBScript and JScript does not require a setup because PTC Mathcad Prime uses the software installed on your operating system. In contrast, using Python requires a setup.
When you use Python as a scripting environment for the first time, PTC Mathcad Prime searches your computer for a supported version of Python. PTC Mathcad Prime supports versions 3.7 through 3.13. If Python is not installed, the script editor is inactive and displays an error message.
Follow these steps to set up Python as a scripting environment. This process is also useful if you have several supported versions of Python installed on your computer, and you want to specify one of them. You can change your version selection later.
|
|
Restart PTC Mathcad Prime after selecting a new Python version.
|
1. Install a supported version of Python on your computer.
2. Go to > and check Set the path to the Python installation folder.
3. Click Browse. The Browse For Folder dialog box opens.
4. Browse to the location where Python is installed on your computer and select the repository.
5. Click OK. The path to the repository is added to the dialog box.
6. Click Close.