External object
All new functions and objects belong to the external object, which
in its turn belongs to the window object. The external object in
the Jscript language is addressed like this:
window.external
Digressions:
All examples given in this section are in the Java
Script language.
The language is case-sensitive so the names of objects
and functions must be written exactly as they are when these objects
and functions are addressed.
The following objects and functions belong to the external object:
Objects
Activation - The object
with functions for activating the eBook and with properties used
by the Buy Page template
AppWindow - The object
with properties and functions for manipulating the Application
Window.
Common - The object with
common functions and properties
ControlBar - The object
with functions and properties used by the Control Bar template
Dialogs - The object
with functions for opening color, file and directory selection
dialog boxes
FileInfo - The object
with properties for retrieving the file path and command-line parameters
of the ebook
Left -
The object with properties and functions for manipulating the Left
Panel of the eBook
Main -
The object with properties and functions for manipulating the Main
Panel of the eBook
Popup -
The object with functions for working with the popup window
Registry - The object
with functions for saving and restoring eBook data and working
with the system registry
Search - The object with
functions and properties used by the Search Bar template
To make it easier to address objects, you can assign an object to
a variable somewhere at the beginning of the page. For example: reg
= window.external.Registry;
After that you can address the
Registry object using just 'reg.'.
Functions
ExecuteFile(FilePath)
Execute an executable file or another document.
Call: window.external.ExecuteFile(FilePath);
Return value: no
Note: FilePath - the path to the file relative to the eBook file.
So, if the eBook file and the file to be launched are in the same
directory, FilePath is just the name of this file. If the eBook file
is in the directory C:\EBooks\My EBook, while the file to be launched
is in C:\EBooks\My EBook\Additional, the FilePath will be 'Additional\FileName.exe'.
ShellExecute(Path, Params, SwParam)
Open a specified file, where Path specifies the file to open, Params
specifies parameters to be passed to the application and SwParam
specifies how the application is to be shown when it is opened.
Call: window.external.ShellExecute(Path, Params, SwParam);
Return value: no
Note: SwParam can be one of the following values:
0 - Hides the window and activates another window.
1 - Activates and displays a window. (Use this value to simply launch the application)
2 - Activates the window and displays it as a minimized window.
3 - Activates the window and displays it as a maximized window.
4 - Displays a window in its most recent size and position.
The active window remains active.
5 - Activates the window and displays it in its current size and position.
6 - Minimizes the specified window and activates the next top-level
window in the Z order.
7 - Displays the window as a minimized window. The active
window remains active.
8 - Displays the window in its current state. The active window
remains active.
9 - Activates and displays the window. If the window is minimized
or maximized, Windows restores it to its original size and position.
ShellExecuteAndWait(Path, Params, SwParam)
This function is identical to ShellExecute except that it
waits for the action to be completed. For example, when using this
function to open a HTML document, it will launch the
default webbrowser and then wait until the browser terminates, only
then this function will call return to its caller.
Call: window.external.ShellExecuteAndWait(Path, Params, SwParam);
Return value: no
TempExtract(RelativeURL)
Extracts a specified file to the temporary folder, where the RelativeURL
is a path relative to the document that uses the function.
Call: window.external.TempExtract(RelativeURL);
Return value: full path to the extracted file
ProcessMessages()
Process all queued messages. Thus, for instance the page that asks
the user to enter his or her registration data shows the «Checking
the data» message and calls ProcessMessages() before it starts
checking the data. And only after that the procedure of checking
the validity of the registration data involving complicated mathematical
calculations is started. If this function is not called in this situation,
the data check will consume processor resources and will not allow
the message to be displayed on the page.
Call: window.external.ProcessMessages();
Return value: no |