Dive into the dynamic world of HTML Executable ebooks and publications! These creations are not just static pages - they are powered by scripts and feature a built-in script engine. Each publication is governed by a suite of scripts, generated and compiled into p-code by HTML Executable. When a publication is launched, it shows an interactive web browser-like environment where your end users can explore your HTML pages and interact with your content.
This dynamic nature allows you to extend the functionality of your publications by writing and invoking your own script functions. This powerful feature opens up a world of possibilities, enabling you to customize your publications to your heart's content.
📝 Note: You don't need to delve into scripting to use HTML Executable and compile publications. Scripting is an advanced feature designed for those who wish to exercise full control over their publications.
✅ The scripting language employed by HTML Executable is known as HEScript. It's built on the Object Pascal language syntax (akin to Embarcadero® Delphi and FreePascal) with a few minor modifications.
✅ Each script that will be compiled into the publication's script collection is listed. You'll see the name of the script along with an optional description. Each script must have a unique name (similar to a namespace).
Here's a simple script example:
// 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;
//Before the publication displays a page. Set Result to True to stop the operation.
Result := False;
// When a page has been displayed.
✅ A script file is essentially a collection of procedures or functions. Each script file has a unique name; each procedure/function also has a unique name within its script file, following these rules:
ØOnly alphanumeric characters may be used, no spaces.
ØEach name must be unique within a given script file, but you can have two different script files that contain procedures or functions with the same name.
ØScript files function like namespaces. When you call a procedure/function or assign it to an event, you'll need to specify the script name, followed by a dot (.), and then the name of the procedure/function, i.e. `[scriptname].[functionprocedurename]`. For example: `UserMain.OnNavigateComplete`
ØEach script is managed by an independent script engine, so you'll need to use global variables to share data between scripts.
ØWhile the use of local variables is possible, it's not recommended for best practices.
Please see these topics too:
•Extend Functionality with HEScript