How to pass a password to the ebook with the command line?
- Can I pass a password from command line?
If the password is incorrect, the ebook should:
1) Show a page containing purchase information about my product.
2) Block access to my presentation at all.
With security profiles and a single HEScript custom function, you can achieve this goal.
First you need to write the HEScript function that checks your password:
- Open your HTML Executable project and select the "Behavior & Scripting" tab.
Then double-click on the "UserMain" script to open the script editor as shown on the figure.
- In the script editor, insert a new script function called "CheckPassword" (you can give it another name but remember it in that case) and paste the script available below; click on Save. The editor is closed.
function CheckPassword: Boolean;
begin
// Returns True if the password of the command line is incorrect.
Result := ParamStr(0) <> "MYPASSWORD";
end;
Be sure to change the MYPASSWORD text to the password you want. In this script version, passwords will be case-sensitive.
Secondly we need to modify the Default security profile; go to the
Security tab and select
Security Profiles. Highlight "
Profile: Default"; click on
Add and choose
Add New Condition.
The "Add a condition" dialog box is shown; choose "
If the following boolean script function returns true". HTML Executable asks you to select the boolean function: it's the "
CheckPassword" one you created previously. Close all the dialog boxes.
Finally, select the new condition and click on "
Configure". Select the "
Locking Pages" tab and enable "
Pages are locked and cannot be viewed".
If you want to display a "registration page", just select it using the "Select" button.
Compile your publication and that's all.
Note: it is also possible to a new security profile that will only forbid a given set of HTML pages, and much more.
If you need help or more samples, feel free to ask in the user
forum∞.