Navigation: For Developers > Extend Functionality with HEScript >
In this topic we'll explore pre-defined HEScript scripts, including the UserMain script, and delve into their global application events.
The UserMain script is an integral part of every project initiated with HTML Executable. It plays a pivotal role by housing numerous global events that enable you to inject special commands and tailor your application's behavior.
Here are some key events provided by the UserMain script:
This event triggers just before the application displays an HTML page. You can set the result to True to halt the operation. NewURL represents the full URL to be displayed, and TargetFrame denotes the frame where the page appears, if any.
It fires when a page has finished loading. URL represents the full URL of the loaded page.
This event occurs when the application starts, just before displaying the homepage. Set Result to True if you wish to exit immediately without any warning.
Triggered when the application is about to terminate.
When a full search is initiated. "what" contains the exact user query.
This event comes into play when a window, specified by WindowName, is displayed. It applies to both main and secondary windows, including pop-ups.
Occurs just before the main window is displayed, right before showing the homepage.
When the main window is minimized to tray.
When the main window is restored from tray.
This event triggers when a user closes a window.
If a user attempts to close a window, this event is called. You can set Result to False to prevent the window from closing, or True to allow it. Note that this event is not created by default and must be added manually to the UserMain script.
This event is triggered by a timer created using the StartTimer HEScript function. It activates when a specified amount of time, determined by the StartTimer function, elapses. Set the result of this function to True if you want to disable the timer or use StopTimer to achieve the same result.
This event occurs when an invalid global password is provided at startup. Set to True if you prefer the application not to display an error message and exit.
Triggers when the global expiration date is reached. Set to True if you wish to bypass error messages and exit.
Occurs when the validation of a registration key failed. Set to True if you want the application to exit.
Lets you decide whether validation of the registration key should be performed at startup or not. Set Result to True if you want the publication to be validated, False otherwise.
This event is called when the PDF viewer loads and displays the PDF whose path is given by PDFPath. Only for the built-in PDF viewer.
This event is called when the user clicks / double-clicks the tray icon.
This event occurs when a new version is detected by the web update feature at publication startup. Set Result to True if you do not want the Web Update dialog box to be displayed and perform actions yourself
Fires when the user prints the current page.
Signal a change in full-screen mode, where FullScreen indicates whether full-screen mode is enabled (true) or disabled (false).
Use this to show or hide your custom controls thanks to the SetUIProp HEScript function.
Explore more about scripting in HTML Executable: