A lot of internal functions are not listed here at this time (but may be used in system HTML pages for instance). Please ignore them or contact us for more information.
Please have a look at the samples, articles and the knowledge base at www.htmlexe.com
Flags: set of bit flags that determine the contents and behavior of the box. More information here. May be MB_OK, MB_OKCANCEL, MB_YESNOCANCEL, MB_YESNO, .... plus MB_ICONSTOP, MB_ICONINFORMATION, MB_ICONWARNING...
Result (integer): may be IDOK, IDCANCEL, ..., IDYES, IDNO depending on the button selected by the user.
Show: True to show the dialog box, False to hide it.
Text: text to display on the dialog box.
After having called ManageWaitForm(True, "...."), do not forget to call ManageWaitForm(False, "....") to hide the dialog box.
Navigation related:
Function name
Description & prototype
Parameters, example, remarks
GoToPage
Displays (or executes) the specified URL.
procedure GoToPage(const Name, Window: String);
Name: partial or full URL to display. This can be a single HTML page, a full URL (you can use the ghe://heserver/ internal protocol, or standard protocols like http, ftp, etc...) or even an hescript:// command.
Window: do not use at this time (internal use only). Leave empty "".
UseMapID
Displays the HTML page whose map ID corresponds to ID.
Lets you load the Table of Contents from an XML file previously saved with HTML Executable (XML Tools in Table of Contents) procedure LoadTOCfromXMLFile(SourceFile: String);
SourceFile: full path to an existing XML file. If the XML file is stored inside the publication, use UnpackTemporaryResource first.
If SourceFile is empty, then the publication loads the default Table of Contents.
Management related:
Function name
Description & prototype
Parameters, example, remarks
SetGlobalVar
Sets the value and properties of a global variable.
IsStored: indicates whether the global variable is a persistent one, i.e. it is stored in the publication's state data file and restored when the publication is run again.
Use global variables to store or exchange data between different scripts.
GetGlobalVar
Gets the value of a global variable.
function GetGlobalVar(const Name, DefaultIfNotFound: String): String;
Name: name of the global variable.
DefaultIfNotFound: what the function should return if the global variable is not found.
Result: the value of the variable if it exists, otherwise the value of DefaultIfNotFound.
Publications use a lot of internal global variables. You can get a list of interesting ones here.
SynchronizeGlobalVar
If several instances of a publication are running, call this function to force all global variables (only the persistent ones: see above) to get the same value as the ones of the publication who made the call.
procedure SynchronizeGlobalVar;
Persistent global variables can be used to share data between several instances of a publication.
Result: the value of the resource string, or empty if not found.
GetManualHardwareID
Returns a unique system ID based on hardware specifications.
function GetManualHardwareID(method: integer): String;
method: method identifier to compute the unique ID.
0: serial number of the first hard disk 1: manufacturer-allocated number used to identify the physical media 2: CPU specifications such as CPU ID 3: manufacturer-allocated number of first hard disk.
ClearCache: True to clear the cache or False to clear the history.
HTML related:
Please note that some of these functions are only designed for HTML Viewer publications, as they try to compensate the lack of JavaScript support. If you work with IE Browser publications, then try to use JavaScript instead.
Function name
Description & prototype
Parameters, example, remarks
ShowHTMLBlockID
Provides an easy way to control the display of a block of HTML text. Typical blocks that can be controlled include <div>, <p>, <ul>, <form>, <table>, etc. The block tag must contain an ID= attribute to identify it.
Controlname: name of the control or form field. There is no need to indicate which form the field belongs to. However your controls should have unique names in an HTML page.
PropertyName: which property should be set. Must be Text if the control is a form field.
PropertyValue: the new value to give to the property.
This function works only in HTML Viewer publications! You can use this function at any time, it does not require a form to be submitted first contrary to the previous functions.
GetFormControlValue
Gets the value of a form field, or a property of an ActiveX control (use of the PANEL tag).
function GetFormControlValue(const ControlName, PropertyName, DefValue: String): String;
Controlname: name of the control or form field. There is no need to indicate which form the field belongs to. However your controls should have unique names in an HTML page.
PropertyName: the property whose value should be read. Must be Text if the control is a form field.
DefValue: the value if the control is not found.
Result: returns the value of the property in string format.
This function works only in HTML Viewer publications!
CallFormControlMethod
Calls a method of an ActiveX control (use of the PANEL tag). Experimental use at this time!
URL: url to the page that should be displayed. It can be a virtual path to a compiled page or a full URL.
Width, Height: width and height of the popup window (in pixels).
Left, Top: x and y screen coordinates of the top-left corner (in pixels).
IsModal: always set the value to false.
RedirectLinksToMain: whether you want the popup window to redirect all hyperlinks to the main window (when a user clicks a link, the page is displayed in the main window). Could be useful for website contents.
To create a screen-centered popup, set both Left and Top to -1.
URL: url to the page that should be displayed. It can be a virtual path to a compiled page or a full URL.
Width, Height: width and height of the popup window (in pixels).
Left, Top: x and y screen coordinates of the top-left corner (in pixels).
IsModal: always set the value to false.
RedirectLinksToMain: whether you want the popup window to redirect all hyperlinks to the main window (when a user clicks a link, the page is displayed in the main window). Could be useful for website contents.
Parameters: additional parameters for creating the popup. Possible parameters include: parentexplicit or parentismain.
Returns the name of the popup which has the focus. function ActivePopupName: String;
ClosePopup
Closes a popup window.
procedure ClosePopup(const Name: String);
Name: name of the popup window that should be closed.
CloseAllPopups
Closes all popup windows that are visible.
procedure CloseAllPopups;
Program /File / Folder functions
Function name
Description & prototype
Parameters, example, remarks
OpenFile
Opens an external document or program file.
function OpenFile(const Filename, Parameters: String; State: Integer): Integer;
Filename: full path to the file you want to open or run.
Parameters: optional command line parameters.
State: window state. May be SW_SHOWNORMAL, SW_SHOWMAXIMIZED, SW_SHOWMINIMIZED, SW_HIDE...
Result: successful if greater than 31.
For executable files, you may also use RunAProgram.
UnpackTemporaryResource
Extracts a file from the publication's data (it must have been compiled) to a temporary file and returns the path to this file. The file is normally removed when the publication closes.
function UnpackTemporaryResource(const SourceName: String): String;
SourceName: virtual path to the file you want to extract from the publication's data.
Result: full path to the extracted temporary file on the user hard disk.
You can use this function to extract and run special files that cannot be handled by the publication, such as video, executable, etc... Useful with OpenFile.
ExportAFile
Same as the previous function, except that it will display a Save As dialog box, and the file is not temporary. Acts as when you download a file from the Internet.
function ExportAFile(const SourceName: String; PromptTitle, DefFilename: String): String;
SourceName: virtual path to the file you want to extract from the publication's data.
PromptTitle: the title of the Save As dialog box.
DefFilename: the default filename that should be used. It can be "*.*".
Result: full path to the final unpacked file.
The file is not removed! Useful if you want to let your end users "download" files from your publication.
GetTemporaryFilename
Returns the full path to a temporary file.
function GetTemporaryFilename: String;
This function may be useful for functions like SaveFormResultsToFile.
function UnpackVirtualResource(const SourceName: String; const DestFile: String): String;
Extracts a file from the publication's data (it must have been compiled) to the virtual memory storage and returns the path to this file. The file only exists in memory: it is not on the hard disk. Nevertheless, it works as if it was on the hard disk at the specified path.
This function will replace the current registration information items with the provided ones. For security reasons, it does not check the validity of the key: at the next startup, the publication will run with the certificate whose key was made for.
ActivateCertificate
Forces the trial publication to activate the certificate that matches the current registration items saved by RegisterPub.
function ActivateCertificate: String;
Should only be used after a call to RegisterPub, and followed by ExitPublication.
Returns the name of the selected certificate. Empty if no certificate matches.
GetCurrentCertificate
Returns the name of the current certificate. Only working if you have Trial publication.
function GetCurrentCertificate: String;
SetDefaultCertificate
Sets the current certificate to default one.
procedure SetDefaultCertificate;
This function causes the publication to come back to the Default certificate. If the default certificate has an expiration period, this period is automatically expired.
MD5OfAString
Converts the string to UTF-8 if not ANSI and computes the MD5 hash sum.
function MD5OfAString(const Str: String): String;
Str: string you want to get the MD5 sum of. Conversion from Unicode to UTF8 is done automatically.
Result: string format of the MD5 sum.
MD5OfAStringUnicode
Computes the MD5 hash sum of a Unicode string.
function MD5OfAStringUnicode(const Str: String): String;
Str: string you want to get the MD5 sum of.
Result: string format of the MD5 sum.
MD5OfAFile
Gets the MD5 hash sum of the specified file.
function MD5OfAFile(const Path: String): String;
Path: full path to the file you want to get the MD5 sum of.
Result: string format of the MD5 sum.
InputBox
Prompts your end users for a query (a dialog box is shown)
function InputBox(const Query, Title, Default: String): String;
Query: the prompt text. Tells your end users what you are asking.
Title: title of the dialog box.
Default: the default value to display in the field.
Result: returns what end users answered or an empty value if they chose "Cancel".
ParamStr
Returns the index-th parameter passed to the program using the command line.
function ParamStr(index: Integer): String;
Index: index of the parameter you want to obtain.
Note: use double quotes to wrap multiple words as one parameter (such as long file names containing spaces).
StartTimer
Starts a timer to trigger an event, either one time or repeatedly, after a measured interval. Write the code that you want to occur at the specified time inside the UserMain's OnTimer function event.
TimerName: name of the custom timer. NOT CURRENTLY USED. Just leave empty.
Interval: determines the amount of time, in milliseconds, that passes before the timer initiates another OnTimer event. For example 1000 for one second. Note: A 0 value is valid, however the timer won't call an OnTimer event for a value of 0.
StopTimer
Stops a timer that was created by StartTimer.
procedure StopTimer(const TimerName: String);
TimerName: name of the custom timer. NOT CURRENTLY USED. Just leave empty.
StrUnicodeToUtf8
Converts a normal Unicode string to a UTF8 encoded string.
function StrUnicodeToUtf8(const Str: String): String;
Str: the string you want to convert.
StrUtf8ToUnicode
Converts a UTF8 encoded string to a normal Unicode string.
function StrUtf8ToUnicode(const Str: String): String;
Str: the string you want to convert.
IsIEEngine
Indicates the type of publication: HTML Viewer or IE Browser.
function IsIEEngine: Boolean;
Returns True if the publication is an IE Browser one. This function is used internally.
SetClipboardText
Set the contents of the Windows Clipboard to the text from Data. procedure SetClipboardText(const Data: String);
Data: the text data to put in the clipboard.
GetClipboardText
Retrieves the contents from the Windows Clipboard as text. function GetClipboardText: String;
Some Delphi classes like TStringList, TMemoryStream are also supported.
To use these classes, you must define the Classes unit at the top of your scripts:
This is the online documentation of HTML Executable.
About HTML Executable
HTML Executable is a versatile HTML compiler and ebook compiler: it lets you create secure ebooks and desktop applications with your websites, HTML or PDF documents.
You can easily create attractive ebooks, full-featured HTML applications (RIA) and software, digital publications from your websites, PDF files and HTML documents for online or offline distribution.