API Client Calls

Structure Snippets can be automated through FDK clients, FrameScript or ExtendScript.

There are two API client calls available for use from other FDK plugins, FrameScript, or ExtendScript. These client calls are made from an FDK client using the F_ApiCallClient() function. A similar call can be made from ExtendScript or FrameScript using the CallClient() function. In all cases the first parameter is the StructureSnippets client name, which is “Pubs-Tools:StructureSnippets” (case sensitive). This must exactly match the spelling and casing of the entry in the maker.ini APIClients section. For example, to use the INSERTSNIPPET call, the following code could be used:

F_ApiCallClient("Pubs-Tools:StructureSnippets", 
  "INSERTSNIPPET simpletable notetable 1");

INSERTSNIPPET

Inserts a previously defined “snippet” at the current insertion point (or selection). The syntax is a space-delimited string as follows:

INSERTSNIPPET <elemname> <snipname> <sniptype>

Where:

<elemname>
The element name of the snippet to be inserted.
<snipname>
The name of the snippet.
<sniptype>
“1” for a local snippet or “2” for a remote snippet.

These values correspond directly to the values used to create the snippet.

RUNSNIPPETSCRIPT

Runs a snippet script on the current document or book. The snippet script (snippetscript.ini) must exist in the folder that contains the file being processed. Use the following syntax:

RUNSNIPPETSCRIPT [<docOrBookId>]

Where:

<docOrBookId>
The ID of the document or book to process (optional). If not provided, the current document or book is assumed.