Navigation: For Developers > Extend Functionality with HEScript > Sample Scripts > |
|
This is a tutorial on how to request a password to enable users to exit your HTML Executable ebook. This tutorial will guide you through the steps in a clear and concise manner. Let's begin!
You want to prompt for a password to allow users to close your ebook. This can be achieved by making some changes to your HEScript script.
Open your HTML Executable project and navigate to the Script Manager. Double-click the "UserMain" script to open the script editor.
In the script editor, replace the existing `OnWindowCloseQuery` block code with the following code:
function OnWindowCloseQuery(WindowName: String): Boolean;
var
S: String;
begin
// Occurs when the user wants to close the window.
// Note: set to False if you do not want to close the window.
S := InputBox("To exit, please enter the password", "Security", "");
Result := S = "OurPassword"; // replace OurPassword by what you want. Do not remove quotes.
end;
Don't forget to save your script!
Compile your project and that's it!
👉 Please note that the ebook will be automatically closed without password if the user shuts down their computer. |