Scripting Interface

The scripting interface is implemented as a COM object. Since it uses an object-oriented model, it exposes a number of properties and methods.

A property appears as a variable with a string or integer value. Some can be changed by the calling application (read/write); others can only be queried (read only). A list of the available properties can be found below.

The methods are similar to function calls, and are described in the reference section along with the other API calls. A method description appears like this:

Scripting call:
result = method-name (arg1, arg2 ...)

The name of the result and each of the arguments indicates the type:

Prefix Example Type
s sPart A string.
n nStatus A number.
b bShow A boolean (true or false). If the host language does not support these constants, use 1 for true and 0 for false.

To use the scripting interface the calling application must obtain an instance of the object. This is most easily done using the ProgID of the control: “TurnKeySystems.TopLeaf”.

For example, here is an extract from a JavaScript program that uses the scripting interface:

var topleaf = new ActiveXObject("TurnKeySystems.TopLeaf");
var pdf = topleaf.XmlToPdf("Publication", xml, "C:\\Temp");
Application.Alert("PDF="+pdf);
[Warning] Warning

The scripting interface relies on the TopLeaf API library, which is not thread-safe. This may make the scripting interface unsafe to use in some applications.

[Note] Note

The scripting interface is implemented as a 32-bit binary. On a 64-bit system you must use a compatible host environment.

For example, on Windows 7:

C:\Windows\syswow64\cscript topleaf.js