Script Modules - Tips
- The dprint() function is per Script Module. Check the Debug Dialog of the correct Script Module for these outputs.
- Changes made to the Script Engine after it has started DO NOT take effect until it has been stopped and started again.
- A web view can only be owned by one Script Module at a time. When a Script Module points a web view to a custom interface in another Script Module, it transfer the web view's ownership to the other Script Module, and will no longer have access to it.
- Local resources for custom interface such as images, css, and js files should be imported into the Custom Interface tab. External resources may not be resolved if an absolute path is not supplied.
- Editing a Script Module does not save it to disk until you click on Save in the Scripting Interface for PT Script Modules, or File Save for File Script Modules.
- Script Modules need to clean up when stopping by placing clean-up code in the cleanUp() function. Menu items added, web views created, GUI locked, and anything else done at or after the Script Module started should be cleaned up.
- Data store files of all Script Modules are saved in PT options. They are not saved to the pts file unless the user edits the Script Module and saves it to pts file.
- Events and delegates are not supported in web views.
- JavaScript statements to web views that may change the GUI, such as alert popups, layouts, HTML element changes should use evaluateJavaScriptAsync(). Using evaluateJavaScript() may crash PT.
- After creating a new web view, show() needs to be called in order to show the web view.
- To check a connectivity test PDU, use AssessmentModel.getLastConnectivityTestResultsAt(index).
- To check a PDU from the user's working network, use AssessmentModel.getPDUStatus("Scenario Name", index). If the user's PDU is a periodic PDU, you must stop it first, otherwise the status will always be "In Progress". To stop it, use AssessmentModel.stopPeriodicPDU("Scenario name", index).
- JavaScript's setTimeout(), setInterval(), clearTimeout(), and clearInterval() are supported in both the Script Engine and web views.
- Use AssessmentModel for activity file related calls. See API for reference.
- setExclusive() in CIpcManager.pki affects both ExApps and Script Modules. Once an ExApp or Script Module makes this call, all other ExApps and Script Modules will be disconnected.