Navigation: For Developers >

Application Global Variables

 

 

 

 

Global variables play a crucial role in HTML Executable, allowing HEScript and JavaScript scripts to share data and store values within your application. They are a powerful tool for enhancing interactivity and storing/sharing data.

 

Managing Global Variables

 

You can manage global variables using two different methods:

 

ØHEScript: Utilize the SetGlobalVar and GetGlobalVar functions for seamless control.

ØJavaScript: Employ the SetGlobalVariable and GetGlobalVariable methods to manipulate global variables in your scripts.

 

Global variables offer improved security and functionality compared to cookies, making them an ideal choice for data sharing in your publication.

 

Properties

 

Here are some key properties of global variables:

 

ØUnique Names: Global variable names must consist of alphanumeric characters without spaces. Avoid using names starting with "HE" to prevent conflicts with internal variables used by HTML Executable.

ØPersistence: Global variables can be either persistent or temporary. Persistent variables are saved in the publication's state file and loaded in subsequent sessions, while temporary variables exist only for the current session. You can set a variable's persistence using the SetGlobalVar method.

ØInstance Isolation: Global variables are not shared between multiple running instances of a publication. However, you can synchronize global variables across all instances by using the SynchronizeGlobalVar function.

 

Pre-defined Global Variables

 

HTML Executable provides several pre-defined global variables for various purposes. Here's a list of some commonly used ones:

 

Global Variable Name

Description

HELasterrormessage

When an error occurs, this variable contains the error message.

DefWinTitle

The title of the main window.

HomePage

The index page's filename.

HEPubStorageLocation

The path where the publication stores its data. You can customize it.

HEPubTempPath

The path to a temporary location where the publication stores its external files temporarily. This will change each time.

HEPublicationDiskInfo

Contains the device ID returned by Windows of the USB disk on which the publication EXE lies.

CurPageTitle

The title of the page which is currently displayed.

FwdButtonEnabled

Is the forward button enabled? (true/false)

BackButtonEnabled

Is the back button enabled? (true/false)

HEPublicationFile

The full path to the publication's .exe file (including filename)

HEPublicationPath

The full path to the folder that contains the publication's .exe file (no filename). It will always include the path trailing backslash (e.g. C:\MyPath\).

HEPubRegistered

Boolean (0 or 1). Indicates whether the publication is registered or not. 0 = Trial ; 1 = Registered. Only available in a Restricted Publication.

HEPubUserName

Contains the name of the registered user. Only available in a Restricted Publication.

HEPubUserData1

Contains the company name of the registered user. Only available in a Restricted Publication.

HEPubExpired

Boolean (0 or 1). Indicates whether the trial period is over or not. Only available in a Restricted Publication.

HEPubDays

Contains the number of remaining days in the trial period. Only available in a Restricted Publication with a trial period, based on number of days.

HEPubRuns

Contains the number of times the publication has been started in the trial period. Only available in a Restricted Publication with a trial period, based on number of runs.

HEPublicationOnUSB

Boolean (0 or 1). Tells you whether the publication is on a USB drive or not. In order to be used, GetManualHardwareID(1) must be invoked first. For example, using this global variable lets you decide whether a publication may be run or not.

HEShowPDFBookmarks

Boolean (0 or 1). Enables the display of the navigation bookmark panel at startup: when the PDF is loaded, its bookmarks are automatically listed. By default, it is set to 0.

HEDongleLicCount

For enkySL dongles. Contains the trial frequency value.

HEDongleTrialDay

For enkySL or enkyCT dongles. Contains the trial days value.

HEDongleExpirationDate

For enkySL or enkyCT dongles. Contains the authorization expiration date in year/month/day value.

 

⚠ Please note that you should only read the values of these variables and avoid setting their values yourself.

 

With these additional global variables, you have more tools at your disposal to customize and enhance your HTML Executable ebooks and applications.