Navigation: For Developers > Extend Functionality with HEScript >

Quickly Add HEScript Code

 

 

 

 

This tutorial will walk you through the process of extending the functionality of your ebook application using HEScript. Whether you're a seasoned developer or just starting out, this guide will make the process of adding HEScript functions or procedures to your application a breeze.

 

Adding HEScript Code to Your Application 📝

 

Suppose you've found some useful HEScript code on our forum that you'd like to incorporate into your application. Here's how you can do it:

 

  Open HTML Executable and navigate to Application Settings => Scripting.

  Double-click on `UserMain` in the list to open the script editor.

 

 

👉 For a comprehensive overview of the script editor and its features, check out our Script Editor Guide.

 

  Paste the entire function you want to use into the editor. For example, the following HEScript code returns the path to the "My Documents" directory:

 

function GetDocPath: String;
begin
Result := GetSpecialFolderPath(16);
end;

 

  Click Save Script. Voila! Your script is ready to use!

 

Executing Your HEScript Code 🚀

 

You can use JavaScript or HTML links to invoke your HEScript functions or procedures.

 

👉 Visit our JavaScript-HEScript Guide for examples and syntax details.

 

For more information, explore the following topics:

 

Extend Functionality with HEScript

HEScript Script Editor

HEScript Function Reference

Run and Call HEScript From JavaScript And HTML

UserMain Script And Script Templates

Sample Scripts

How to prompt end users for their name once and store it?

How to password protect pages?

How to call a javascript function from HEScript (toolbar, menubar)?

How to call DLL functions?

How to open an external file

How to open subfolders of a given folder or disk?

How to prompt for a password for closing ebook?

How to run an executable file or app?

How to dynamically modify the Table of Contents?

HTML Executable JavaScript API

Special Targets for External Links

Application Global Variables

Publication Command Line Arguments

Command Line - Directives

Environment Options