---
title: HEScript Function Reference
description: "HEScript is specially designed to control application behavior and communicate with the Windows environment. There are many **internal functions** that can be called from your HEScript procedures and functions. **Notes:** - Many internal functions are not listed here, as they…"
url: "https://www.exeoutput.com/help/scriptreference"
updated: "2025-10-01"
category: Scripting with HEScript
---

# HEScript Function Reference

HEScript is specially designed to control application behavior and communicate with the Windows environment.

There are many **internal functions** that can be called from your HEScript procedures and functions.

**Notes:**

- Many internal functions are not listed here, as they may be used, for instance, in system HTML pages. Please ignore them or contact us for more information.
- You can find additional Object Pascal references at [delphibasics.co.uk](https://www.delphibasics.co.uk/).

## Interface Functions

| Function Name | Description & Prototype | Parameters, Example, Remarks |
| --- | --- | --- |
| **MessageBox** | Displays a message box (similar to the Windows API `MessageBox`). **function** MessageBox(**const** Text, Title: **String**; **const** Flags: Integer): Integer; | - **Text**: The contents of the message box. - **Title**: The title of the message box. - **Flags**: A set of bit flags that determines the contents and behavior of the dialog box. [More information here](http://msdn.microsoft.com/en-us/library/windows/desktop/ms645505%28v=vs.85%29.aspx). Can be `MB_OK`, `MB_OKCANCEL`, `MB_YESNO`, etc., combined with `MB_ICONSTOP`, `MB_ICONINFORMATION`, etc. - **Result (Integer)**: Can be `IDOK`, `IDCANCEL`, `IDYES`, `IDNO`, etc., depending on the button the user selects. |
| **MessageDlg** | Displays a themeable message box. **function** MessageDlg(**const** Message, Title: **String**; DialogType: TMsgDlgType; Buttons: TMsgDlgButtons): Integer; | - **DialogType**: Can be `mtWarning`, `mtError`, `mtInformation`, `mtConfirmation`, or `mtCustom`. - **Buttons**: A set of flags defining the buttons, e.g., `[mbYes, mbNo]` or `[mbOK]`. **Note:** This function should not be called during the initialization event or when the application exits. |
| **SetUIProp** | Sets the value of a specified property for a control. **procedure** SetUIProp(**const** id, propname, propval: **String**); | - **id**: Name of the control. - **propname**: Name of the property. - **propval**: The new string value to assign. |
| **GetUIProp** | Gets the value of a specified property for a control. **function** GetUIProp(**const** id, propname: **String**): **String**; | - **result**: The string value of the property. An error may occur if the control is not found. |
| **ChangeStatusBar** | Sets the text of the status bar. **procedure** ChangeStatusBar(**const** Text: **String**; Reset: Boolean); | - **Reset**: If `True`, this text will be set as the default. |
| **ShowAboutBox** | Shows the About box. **procedure** ShowAboutBox; |  |
| **ManageWaitForm** | Shows or hides a “Please wait…” dialog box. **procedure** ManageWaitForm(Show: Boolean; Text: **String**); | - **Show**: `True` to show the dialog box; `False` to hide it. After calling `ManageWaitForm(True, "...")`, you must call `ManageWaitForm(False, "...")` to hide it. |

## Navigation Functions

| **GoToPage** | Displays or executes the specified URL. **procedure** GoToPage(**const** Name, Window: **String**); | - **Name**: The partial or full URL to display. - **Window**: For internal use only. Leave empty (`""`). |
| --- | --- | --- |
| **ExitPublication** | Terminates the application. **procedure** ExitPublication; |  |
| **NavigateCommand** | Executes a standard navigation command. **procedure** NavigateCommand(**const** Command: Integer); | **Command** can be: 0 (Back), 1 (Forward), 3 (Copy), 4 (Select All), 5 (Paste), 6 (Zoom In), 7 (Zoom Out), 9 (Cut), 10 (View Source), 11 (Delete), 12 (Dev Tools), 13 (Update Preferences). |
| **ExecuteLiveHEScript** | Compiles and executes HEScript code at runtime. **function** ExecuteLiveHEScript(const Code: String): String; | The **Code** must be a complete block, including `begin` and `end;`. |
| **ExecutePHPScript** | Executes PHP code and optionally returns the output. **function** ExecutePHPScript(const PHPCode: String): String; | The **PHPCode** must include the `<?php` and `?>` tags. |
| **ExecuteHTMLScript** | Executes a JavaScript function in the current HTML page. **procedure** ExecuteHTMLScript(const CommandLine, scriptURL: String); | **CommandLine** is the script function to call, including arguments. |

## Management Functions

| **SetGlobalVar** | Sets the value of a global variable. **procedure** SetGlobalVar(const Name, Value: **String**; const IsStored: Boolean); | **IsStored**: If `True`, the variable is persistent (saved and restored on next run). |
| --- | --- | --- |
| **GetGlobalVar** | Gets the value of a global variable. **function** GetGlobalVar(const Name, DefaultIfNotFound: **String**): **String**; | Returns **DefaultIfNotFound** if the variable doesn't exist. |
| **GetString** | Returns the value of a [resource string](localization#howtostring). **function** GetString(const ID: **String**): **String**; | Returns the value of the resource string, or empty if not found. |
| **GetManualHardwareID** | Returns a unique system ID based on hardware specs. **function** GetManualHardwareID(method: integer): **String**; | **method**: 0 (HDD Serial), 1 (Media ID), 2 (CPU ID), 3 (HDD Manufacturer ID). |

## Program, File, and Folder Functions

| **OpenFile** | Opens an external document or program file. **function** OpenFile(const Filename, Parameters: String; State: Integer): Integer; | **Result** is successful if greater than 31. |
| --- | --- | --- |
| **UnpackTemporaryResource** | Extracts a compiled file to a temporary file and returns the path. The file is removed when the application closes. **function** UnpackTemporaryResource(const SourceName: **String**): **String**; | Useful with `OpenFile` for files that can't be handled internally (videos, etc.). |
| **RunAProgram** | Executes the specified program file. **function** RunAProgram(const Filename, Params, WorkingDir: String; Wait: Boolean; DispWindow: Integer): Boolean; | **Wait**: If `True`, the application waits for the program to finish. |
| **OpenFileDialog** | Displays the standard "File Open" dialog box. **function** OpenFileDialog(**const** aTitle, aFilename, aDefaultExt, aFilter, aInitialDir: **String**): **String**; | Returns the full path to the selected file, or an empty string if canceled. **Warning:** The main window must be available. |
| **SaveFileDialog** | Displays the standard "File Save As" dialog box. **function** SaveFileDialog(**const** aTitle, aFilename, aDefaultExt, aFilter, aInitialDir: **String**): **String**; | Returns the full path to the selected file, or an empty string if canceled. **Warning:** The main window must be available. |
| **SelectDirectory** | Displays a "Browse For Folder" dialog box. **function** SelectDirectory(**const** Caption: **String**; **const** Root: **String**): **String**; | Returns the full path to the selected folder, or an empty string if canceled. |

## Miscellaneous Functions

| **MD5OfAString** | Computes the MD5 hash of a string (converts to UTF-8 first). **function** MD5OfAString(**const** Str: String): **String**; |  |
| --- | --- | --- |
| **InputBox** | Prompts the user for input with a dialog box. **function** InputBox(**const** Query, Title, Default: **String**): **String**; | Returns the user's input, or an empty string if they chose “Cancel”. |
| **StartTimer** | Starts a timer to trigger an event after a specified interval. **procedure** StartTimer(**const** TimerName: **String**; **const** Interval: Cardinal); | **Interval** is in milliseconds (e.g., 1000 for one second). |
| **StopTimer** | Stops a timer started by `StartTimer`. **procedure** StopTimer(**const** TimerName: **String**); |  |

## Delphi Class Support

Some Delphi classes, such as **TStringList** and **TMemoryStream**, are also supported.

To use these classes, you must add the `Classes` unit to the `uses` clause at the top of your script:

```pascal
uses Classes;
```

To use the `TRegistry` object, add the `Registry` unit:

```pascal
uses Registry;

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

Other Windows dialog boxes, such as the Color Picker dialog, are also available through the script engine if you add the `Dialogs` unit:

```pascal
uses Dialogs;

procedure StartIt;
var
  CD: TColorDialog;
  S: String;
begin
  CD := TColorDialog.Create(nil);
  if CD.Execute(0) then
  begin
    S := inttostr(CD.Color);
    ShowMessage(S);
  end;
  CD.Free;
end;
```

[Introduction to Scripting](scripting)

[Using the Script Manager](scripting)
