ExeOutput for PHP allows you to create cron jobs using the TTimer component. This advanced feature allows you to run HEScript functions or PHP code in the background at regular intervals.
Creating a Timer / Cron Job #
To create a timer, add a “Timer (cron)” to the “Components Used” list and then click Edit Timer.
The UI editor will appear, displaying a ready-to-use timer that you can configure.
Configuring a Timer #
In the UI editor, select the Timer component (Step 1):

Configure the properties of the Timer component (Step 2):
- Enabled: When
False, the timer is not running. It is recommended to only enable timers programmatically (see below). - Interval: Specify the interval in milliseconds (for example, 1000 equals one second). This determines how frequently the defined action occurs. Each time the specified interval passes, the action is triggered.
- Enabled: When
Define the action to be executed by the Timer component (Step 3). The only actions useful for timers are Execute PHP code and Execute an HEScript function. Learn more about control actions.
For example, to configure the timer to execute a PHP script, ensure the script is available in the application’s root folder. Then, use the PHP
includecommand as shown in the screenshot above (Step 3):<?php include('cron.php'); ?>
Starting and Stopping Timers Programmatically #
To start a timer component, use the StartTimer function defined in HEScript.
For instance, to start the timer named Timer1, pass its reference, which is Component Name + Control Name. In our case, it is timer1Timer1.

In this example, we want to start the timer when the application starts. In the UserMain script, insert the following code:
procedure OnStartMainWindow;
begin
// When the main window is going to be displayed (just before the homepage is shown).
StartTimer("timer1Timer1", 15000); // Starts the timer named Timer1 in the timer1 component and sets its interval to 15000ms.
end;Warning
Once a timer is started, it will not stop until the application is closed or you explicitly stop it with the StopTimer function.
To stop a timer component, use the StopTimer function defined in HEScript.
procedure StopIt;
begin
StopTimer("timer1Timer1");
end;