Application Settings - Scripting
This page contains scripting tools to extend the normal behavior of your applications with user scripts written in HEScript.
User Scripts: the Script Manager¶
Use HEScript scripting to customize your applications. ExeOutput for PHP employs a scripting language called HEScript. Scripts are compiled during compilation into p-code for faster execution at runtime (unlike JavaScript). That's why scripts are separated from HTML pages and stored in a script manager. You can manage scripts using this tab.
You may use HEScript in addition to PHP and JavaScript. In fact, JavaScript, PHP, and HEScript can be easily combined.
Introduction to scripting with HEScript
Each script that will be compiled into the script collection of the application is listed. You have the name of the script and an optional description. Each script must have a unique name (similar to a namespace).
To add a new script, press Add and the following window will appear:
First, give a name to the script. Spaces and special characters are not allowed (only alphanumeric ones). The maximum length for a script name is 255 characters.
More information about the pre-defined script UserMain
You can give an optional description to your script. However, it is not used by ExeOutput for PHP.
Press OK to start your new script; the script editor will then be displayed to edit your new script:
You are not required to edit your script right away. Just click Save to finish the script editing: you will see that the new script then appears in the script list.
More information about the script editor.
Notes¶
- By default, ExeOutput for PHP automatically adds a "UserMain" script when a project is created. This script is designed for your use and contains some pre-defined global events related to the application.
- You can also call HEScript functions from your PHP, HTML code (links), and even from JavaScript.
- Scripts are stored inside the project file. No external file is required.
To edit a given script, select it in the list and press Edit. You can also double-click it. The script editor will be displayed.
To remove a script, select it in the list and press Remove. Note that you cannot remove the UserMain script.
To import/export a script, select it in the list and press XML. Then select Import/Export and you will be prompted to enter the filename for the XML file. Scripts are stored in XML format so you can edit them with any XML editor (or even Notepad if you wish). When you import a script back, the script editor is displayed: press Save to import the script. Note that an imported script is automatically syntax-checked (this prevents possible script errors during the compilation of the application).