Ebooks and publications made with HTML Executable are actually script-driven and they feature a built-in script engine. A publication is therefore managed by a collection of scripts that were generated and compiled into p-code by HTML Executable. When a publication is run, its runtime module executes the different scripts in order to simulate a web browser where end users can view your HTML pages, and to respond to the actions performed by your end users.
You can therefore extend the functionality of publications by writing and calling your own script functions. This feature allows you to do almost anything you want.
Note that you do not have to work with scripting in order to use HTML Executable and compile publications. Scripting is for advanced users who want to have full control over their publications.
The script language used by HTML Executable is called HEScript. It is based on the Object Pascal language syntax (similar to Embarcadero® Delphi and FreePascal) with some minor changes.
Each script that will be compiled into the script collection of the publication is listed. You have the name of the script and an optional description. Each script must have a unique name (similar to a namespace).
A simple script example:
// UserMain // This script contains special functions related to some of the events triggered by the publication. //You can then optionally add new commands. function OnBeforeNavigate(NewURL, TargetFrame: String): Boolean; begin //Before the publication displays a page. Set Result to True to stop the operation. Result := False; end; procedure OnNavigateComplete; begin // When a page has been displayed. end;
A script file is a group of procedures or functions. Each script file has a unique name; each procedure/function has a name following these rules:
only alphanumeric characters may be used, no space.
each name must be unique in a given script file, but you can have two different script files that contain procedures or functions with the same name.
Please see these topics too:
Copyright G.D.G. Software 2018. All rights reserved