HEScript Function Reference

Applies to HTML Viewer, IE Browser publications.

HEScript scripts are especially designed to control the publication’s behavior and to communicate with the environment (runtime module, Windows…).

You have a lot of internal functions or macros that can be called from within the HEScript script functions/procedures.

Notes:

  • 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.
  • You can find additional references to Pascal Object on http://www.delphibasics.co.uk/

Interface functions

Function nameDescription & prototypeParameters, example, remarks
MessageBoxDisplays a message box (similar to the Windows API MessageBox)

function MessageBox(const Text: String; const Title: String; const Flags: Integer): Integer;
* Text: the contents of the message box.
* Title: the title of the message box.
* 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.
MessageDlgDisplays a skinnable message box.

function MessageDlg (const Message : string; const Title: String; DialogType : TMsgDlgType; Buttons : TMsgDlgButtons) : Integer;
* Message: the contents of the message box.
* Title: the title of the message box.
* DialogType: can be one of the following enumerated values: mtWarning, mtError, mtInformation, mtConfirmation or mtCustom.
* Buttons: set of flags between [ ] that define the buttons of the message box: mbYes, mbNo, mbOK, mbCancel. Examples: [mbYes, mbNo] or [mbOK]
* Result (integer): may be IDOK, IDCANCEL, …, IDYES, IDNO depending on the button selected by the user.

Example:

MessageDlg(“My message”, “My title”, mtInformation, [mbOK]);

More details available here

Note: this function should not be called in the initialization event nor when the publication exits.
SetMenuPropSets the value of the specified property of a menu item whose name is given by id. For internal use.

procedure SetMenuProp(const id, propname, propval: String);
* id: name of the menu item.
* propname: name of the property.
* propval: new value to give (always string).
SetUIPropSets the value of the specified property of a control whose name is given by id. For internal use.

procedure SetUIProp(const id, propname, propval: String);
* id: name of the control.
* propname: name of the property.
* propval: new value to give (always string).
GetUIPropGets the value of the specified property of a control whose name is given by id. For internal use.

function GetUIProp(const id, propname: String): String;
* id: name of the control.
* propname: name of the property.
* result: the value of the property (in string format). If the control is not found, an error may occur.
ChangeStatusBarSets the text of the status bar.

procedure ChangeStatusBar(const Text: String; Reset: Boolean);
* Text: new text to show in the status bar.
* Reset: if true, the text will be set as the default text.
ShowLeftPanelOpens/hides the specified navigation panel.

procedure ShowLeftPanel(const id: Integer; OpenIt: Boolean);
* Id: index of the panel you want to show.
* OpenIt: if false, the navigation panel is hidden (whatever the value of Id). Otherwise it is displayed.

Possible ID values:
* 1: Search.
* 2: TOC (Table of Contents)
* 3: Favorites
* 4: Favorite Manager

IMPORTANT: the navigation panel must have been enabled in HTML Executable! Otherwise you will get problems.
GetLeftPanelReturns the index of the current navigation panel.

function GetLeftPanel: Integer
* Result: index of the panel currently displayed.

See possible values above. Returns 0 if no panel is displayed.
ShowAboutBoxShows the About box.

procedure ShowAboutBox;
ManageWaitFormShows and then hides a “Please wait…” dialog box.

procedure ManageWaitForm(Show: Boolean; Text: String);
* 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.
Function nameDescription & prototypeParameters, example, remarks
GoToPageDisplays (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 ””.
UseMapIDDisplays the HTML page whose map ID corresponds to ID.

procedure UseMapID(const ID: Integer);
* ID: The map ID of the HTML page.
More information here
ReloadPageReloads the entire page (refresh).

procedure ReloadPage;
GetCurrentHTMLPagePathReturns the full URL to the current HTML page displayed.

function GetCurrentHTMLPagePath: String;
* Result: the full URL to the current displayed page.
ExitPublicationTerminates the publication.

procedure ExitPublication;
NavigateCommandExecutes a common navigation command.

procedure NavigateCommand(const Command: Integer);
* Command: one of the following values:
0: return to the previous page (back).
1: move to the next page (forward).
2: go to the top of the page.
3: copy selected text to clipboard.
4: select the entire page.
5: paste text from clipboard (IE only).
6: page zoom in (IE only).
7: page zoom out (IE only).
8: show Internet Explorer options (IE only) as if you select “Tools > Internet Options” in IE.
9: cut selected text to clipboard
SeqGoPreviousShows the previous page in a Browse Sequence

procedure SeqGoPrevious;
SeqGoNextShows the next page in a Browse Sequence

procedure SeqGoNext;
ExecuteHTMLScriptExecutes a script function in an HTML page (JavaScript, VBScript…). Only available for IE publications.

procedure ExecuteHTMLScript(const CommandLine, Language: String);
* CommandLine: the script function you would like to call including its optional arguments.
* Language: the name of the script language this function is written into (JavaScript, VBScript…)

Example: to call this simple JavaScript function:
<script language="JavaScript">
<!--
function Say(what) 
{
 window.alert(what)
}
-->
</script>

use this:
ExecuteHTMLScript(“Say('this is what I say')”, JavaScript);

RefreshTOCCauses the Table of Contents to be refreshed.

procedure RefreshTOC;
Especially useful if you work with the Visibility HEScript function.
LoadTOCfromXMLFileLets 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.
LoadPDFFromFileLets you load an external PDF file directly in the publication's built in viewer (requires the built-in PDF viewer option to be turned on).

procedure LoadPDFFromFile(PDFPath: String);
* PDFPath: full path to the PDF file you want to open. The PDF file must exist.
PDFViewerCommandLets you send commands to the built-in PDF viewer

function PDFViewerCommand(Command: Integer; Param: Integer): Integer;
* Command: a unique identifier of the command to be sent. See the list of all commands available.
* Param: integer parameter related to the command sent.
* Result: result from the built-in PDF viewer.
PDFViewerCommandStrLets you send commands to the built-in PDF viewer

function PDFViewerCommand(Command: Integer; Param: Integer): Integer;
* Command: a unique identifier of the command to be sent.
* Param: integer parameter related to the command sent.
* Result: result from the built-in PDF viewer.

Management functions

Function nameDescription & prototypeParameters, example, remarks
SetGlobalVarSets the value and properties of a global variable.

procedure SetGlobalVar(const Name, Value: String; const IsStored: Boolean);
* Name: name of the global variable.
* Value: new value for the 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.
GetGlobalVarGets 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.
SynchronizeGlobalVarIf 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.
GetStringReturns the value of a resource string.

function GetString(const ID: String): String;
* ID: name of the resource string.
* Result: the value of the resource string, or empty if not found.
GetManualHardwareIDReturns 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.

If an error occurs, an empty value is returned.
WriteRegStrWrites a string entry in the Windows registry.

procedure WriteRegStr(Root: Integer; Key,Ident,Value: String);
* Root: root key ID, see list below.
* Key: name of the subkey.
* Ident: name of the entry.
* Value: string value to be written.

List of root key IDs:

0: HKEY_CLASSES_ROOT
1: HKEY_CURRENT_CONFIG
2: HKEY_CURRENT_USER
3: HKEY_DYN_DATA
4: HKEY_LOCAL_MACHINE
5: HKEY_USERS
WriteRegDWWrites an integer entry in the Windows registry.

procedure WriteRegDW(Root: Integer; Key,Ident: String; Value: Integer);
* Root: root key ID, see list above.
* Key: name of the subkey.
* Ident: name of the entry.
* Value: integer value to be written.
ReadRegStrReads the value of a string entry from the Windows registry.

function ReadRegStr(Root: Integer; Key,Ident,Default: String): String;
* Root: root key ID, see list above.
* Key: name of the subkey.
* Ident: name of the entry.
* Default: default return value if the entry is not found.
* Result: the value of the string entry.
ReadRegDWReads the value of an integer entry from the Windows registry.

function ReadRegDW(Root: Integer; Key,Ident: String; Default: Integer): Integer;
* Root: root key ID, see list above.
* Key: name of the subkey.
* Ident: name of the entry.
* Default: default return value if the entry is not found.
* Result: the value of the integer entry.
GetViewerSerialReturns the unique ID of the runtime module used to run this publication.

function GetViewerSerial: String;
ClearIECacheOrHistoryLets you clear the IE's cache (Temporary Internet Files) or the IE's history.

procedure ClearIECacheOrHistory(ClearCache: Boolean);
* ClearCache: True to clear the cache or False to clear the history.

HTML functions

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 nameDescription & prototypeParameters, example, remarks
ShowHTMLBlockIDProvides 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.

procedure ShowHTMLBlockID(const ID: String; Visible: Boolean);
* ID: ID of the HTML block.
* Visible: Setting Visible to False hides the block and setting it to True displays the block.

Works both in HTML Viewer and IE browser publications.
GetFormFieldValueReturns the value of a form field (when a form has been submitted, i.e. a Submit button was pressed).

function GetFormFieldValue(const NameField: String; Default: String): String;
* NameField: name of the form field.
* Default: default value if the field is not found.

Be careful: this function will only work when a form has been submitted, so you should use only in special HTML page events like OnFormSubmit.

Should be used only in HTML Viewer publications, but may work in IE browser publications too.
GetFormContentsReturns the entire contents of a form which has been submitted.

function GetFormContents: String;
Warning: it only works with HTML Viewer publications. Use it in special HTML page events like OnFormSubmit.
SaveFormResultsToFileSaves the form results to an external file (if a form has been submitted!).

function SaveFormResultsToFile(const Filename: String): String;
* Filename: output filename (will be in text format).
* Result: returns the Filename value if the operation was successful.

Warning: it only works with HTML Viewer publications currently. Use it in special HTML page events like OnFormSubmit.
SetFormControlValueSets the value of a form field, or a property of an ActiveX control (use of the PANEL tag).

procedure SetFormControlValue(const ControlName, PropertyName, PropertyValue: 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: 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.
GetFormControlValueGets 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!
CallFormControlMethodCalls a method of an ActiveX control (use of the PANEL tag). Experimental use at this time!

procedure CallFormControlMethod(const ControlName, MethodName, MethodParams: String);
* Controlname: name of the control.
* MethodName: name of the method to call.
* MethodParams: parameters to pass to the method (if any). Syntax: Param1|…..|ParamN (use the | character to separate them).

This function works only in HTML Viewer publications!
ShowFindDialogDisplays the Find Text dialog (search in the current HTML page only)

procedure ShowFindDialog(const FindText: String);
* FindText: default text to search for. Parameter only used with HTML Viewer publications.
FindTextInPageSearches through the HTML document for the string, S, returning True if the string is found.

function FindTextInPage(const S: String; MatchCase, Reverse: boolean): boolean;
* S: the text you are looking for.
* MatchCase: If True, a case sensitive search is made.
* Reverse: If True, the search is made in the reverse direction.

The last remaining parameter is ignored in an IE browser publication.
StartFullSearchLaunches a full text search in the entire publication. The Search engine must have been enabled!
The search results are displayed in the navigation panel.

procedure StartFullSearch(const Query: String; ScriptFormatName: String);
* Query: what you are looking for. You may use the logical operators AND, OR, NOT.
* ScriptFormatName: script of the search engine. Must be ”search.hex”.
PrintPagesPrints the current HTML page.

procedure PrintPages(const FromPage, ToPage: Integer; ShowDialog: Boolean);
* Prints the current document starting with FromPage and ending with ToPage. Pages start at page 1.
To print the entire document, set ToPage to 9999.
* ShowDialog: whether the print dialog is displayed or not.

These parameters are ignored in an IE browser publication. Use JavaScript instead.
ShowPrintPreviewDisplays the print preview window.

procedure ShowPrintPreview(const FrameName: String);
* FrameName: if your document uses frame, specify which frame should be displayed in the print preview.

This parameter is ignored in an IE browser publication.
StrToHTMLGenerates the HTML code for the given string.

function StrToHTML(const Str: String): String;
* Str: the string you want to convert to HTML.
PlayMediaFilePlays a media file using the internal media player.

procedure PlayMediaFile(const Source: String; Loop: Integer);
* Source: path to the media file to be played. It should be an absolute path but without the protocol and the root, e.g. MyFolder\Media1.mid
* Loop: how many times the media should be played. Enter -1 for infinite.

The internal media player recognizes MIDI and WAV files. It uses the MCI functions of Windows.

Only for HTML Viewer publications.
StopMediaPlayerStops the media player if it is playing a media file.

procedure StopMediaPlayer;
Only for HTML Viewer publications.
LoadHTMLFromMemoryLoads the HTML contents from a TMemoryStream and displays it.

procedure LoadHTMLFromMemory(Contents: TMemoryStream; const Target: String);
* Contents: a TMemoryStream object that contains HTML data. The function does not free it.
* Target: leave it to ””. For IE publications, you can use HEPopup_[popup name] to load HTML data into a popup rather than the main window.
Function nameDescription & prototypeParameters, example, remarks
ShowPopupOpens the specified URL in a new window.

procedure ShowPopup(const Name, URL: String; Width, Height, Top, Left: Integer; IsModal, RedirectLinksToMain: Boolean);
* Name: name of your popup window.
* 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.

Sample available here
ShowPopupExOpens the specified URL in a new window.

procedure ShowPopupEx(const Name, URL: String; Width, Height, Top, Left: Integer; IsModal, RedirectLinksToMain: Boolean; Parameters: String);
* Name: name of your popup window.
* 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.
parentexplicit: makes the popup independent (disables the z-order auto management).
parentismain: the popup is a child of the main window, and not the window with the page or script that opened it.

To create a screen-centered popup, set both Left and Top to -1.

Sample available here
ActivePopupNameReturns the name of the popup which has the focus.

function ActivePopupName: String;
ClosePopupCloses a popup window.

procedure ClosePopup(const Name: String);
* Name: name of the popup window that should be closed.
CloseAllPopupsCloses all popup windows that are visible.

procedure CloseAllPopups;

Program /File / Folder functions

Function nameDescription & prototypeParameters, example, remarks
OpenFileOpens 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.
OpenFileAdvOpens an external document or program file (advanced: lets you specify the operation to execute).

function OpenFileAdv(const Filename, Parameters, Verb: String; State: Integer): Integer;
* Filename: full path to the file you want to open or run.
* Parameters: optional command line parameters.
* Verb: specifies the action to be performed: open, runas, print…
* 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.
UnpackTemporaryResourceExtracts 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.
ExportAFileSame 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.
GetTemporaryFilenameReturns the full path to a temporary file.

function GetTemporaryFilename: String;
This function may be useful for functions like SaveFormResultsToFile.
RunAProgramExecutes the specified executable program file.

function RunAProgram(const Filename, Params, WorkingDir: String; Wait: Boolean; DispWindow: Integer): Boolean;
* Filename: full path to the .exe file you want to run.
* Params: optional command line parameters.
* WorkingDir: the path to the folder that should be set as the system current one.
* Wait: indicates whether the publication “sleeps” until the end of the program's execution.
* DispWindow: window state. May be SW_SHOWNORMAL, SW_SHOWMAXIMIZED, SW_SHOWMINIMIZED, SW_HIDE…
* Result: True if the program was run successfully.

It does not work with document files.
OpenFileDialogDisplays the standard File Open dialog box.

function OpenFileDialog(const aTitle, aFilename, aDefaultExt, aFilter, aInitialDir: String): String;

Example:
var
S: String;
begin
S := OpenFileDialog(“Select a File”, “*.*”, “*.*”, “All files (*.*)|*.*”, ””);
* aTitle: title of the dialog box.
* aFilename: default filename.
* aDefaultExt: default extension.
* aFilter: file extension filter.
* aInitialDir: initial directory.

Result: returns the full path to the selected file. If canceled, returns an empty string.

Warning: the Main Window must be available (do not use this function in an event like OnPubLoaded).
SaveFileDialogDisplays the standard File Save As dialog box.

function SaveFileDialog(const aTitle, aFilename, aDefaultExt, aFilter, aInitialDir: String): String;
* aTitle: title of the dialog box.
* aFilename: default filename.
* aDefaultExt: default extension.
* aFilter: file extension filter.
* aInitialDir: initial directory.

Result: returns the full path to the selected file. If canceled, returns an empty string.

Warning: the Main Window must be available (do not use this function in an event like OnPubLoaded).
SelectDirectoryDisplays a browse folder dialog box.

function SelectDirectory(const Caption: String; const Root: String): String;
* Caption: indicative text asking for the folder.
* Root: the root folder. Optional: leave it empty to use the Desktop as the root folder.

Result: returns the full path to the selected folder. If canceled, returns an empty string.
ClearVirtualCacheClears the entire virtual memory storage.

procedure ClearVirtualCache;
For advanced users only.
UnpackVirtualResourcefunction 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.

Virtualization must be enabled.
For advanced users only.

* SourceName: virtual path to the file you want to extract from the publication's data.
* DestFile: optional, a full path to the output virtual file. If you leave it empty, the path will be “publication's temporary folder+filename”.
* Result: full path to the virtual file or empty if an error occurred.

RemoveVirtualResourceprocedure RemoveVirtualResource(const DestFile: String);

Removes a file from the virtual memory storage and frees associated memory.

Virtualization must be enabled.
For advanced users only.

DestFile: full path to the virtual file that should be deleted.
GetSpecialFolderPathReturns the path to a special Windows folder

function GetSpecialFolderPath( FolderID: integer): String;
* FolderID: CSIDL_xxx value.
Result: full path to the folder.

Miscellaneous functions

Function nameDescription & prototypeParameters, example, remarks
ReplaceStringReturns a string with occurrences of one substring replaced by another substring

function ReplaceString(const Original,OldPattern, NewPattern: string): String;
* Original: original string with old patterns.
* OldPattern: string to replace.
* NewPattern: the new string that takes the place.
* Result: the new string with all replaced patterns.

Similar to StringReplace in Delphi SysUtils.
RegisterPubRegisters a Trial publication. Only working if you have Trial publication.

You should then call ActivateCertificate in order to apply changes.

procedure RegisterPub(name, data1, data2, key: String);
* Name: user name.
* Data1, Data2: optional. Used to generate the key.
* Key: the key specified by user.

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.
ActivateCertificateForces 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.
GetCurrentCertificateReturns the name of the current certificate. Only working if you have Trial publication.

function GetCurrentCertificate: String;
SetDefaultCertificateSets 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.
MD5OfAStringConverts 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.
MD5OfAStringUnicodeComputes 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.
MD5OfAFileGets 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.
InputBoxPrompts 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”.
ParamStrReturns 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).
StartTimerStarts 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.

procedure StartTimer(const TimerName: String; const Interval: Cardinal);
* 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.
StopTimerStops a timer that was created by StartTimer.

procedure StopTimer(const TimerName: String);
* TimerName: name of the custom timer. NOT CURRENTLY USED. Just leave empty.
StrUnicodeToUtf8Converts a normal Unicode string to a UTF8 encoded string.

function StrUnicodeToUtf8(const Str: String): String;
* Str: the string you want to convert.
StrUtf8ToUnicodeConverts a UTF8 encoded string to a normal Unicode string.

function StrUtf8ToUnicode(const Str: String): String;
* Str: the string you want to convert.
IsIEEngineIndicates 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.
SetClipboardTextSet 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.
GetClipboardTextRetrieves the contents from the Windows Clipboard as text.

function GetClipboardText: String;
RandomRangeGenerates a random Integer number within the range RangeFrom to RangeTo inclusively.

function RandomRange(const RangeFrom, RangeTo: Integer): Integer;

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:

uses Classes;

To use the TRegistry object, define the Registry unit at the top of your scripts:

uses Registry;

For instance, the following script lets you remove a registry key:

uses Registry; 

procedure Test1;
var
reg: TRegistry;
begin
reg := TRegistry.Create;
reg.RootKey := HKEY_LOCAL_MACHINE;
reg.DeleteKey("Software  HEViewer  Coucou"); 
reg.CloseKey(); 
reg.Free;
end;

Introduction to Scripting

Using the Script Manager


Copyright G.D.G. Software 2018. All rights reserved