Usage

This section gives an overview of the general usage of the priint:comet Python API

Import directives

Usually, Python modules are imported by providing the module or package name:

Importing in Python
#Native libaries
import io
import csv

#Comet
import comet

These can be either native built-ins (e.g. io, csv, …), built-ins provided by our implementation (comet) or custom modules which are data pool specific.

Imports work like CScript #include statements. The CScript interpreter uses a custom callback for processing an #include directive. We are therefore able to implement custom syntax extensions using tokens to fetch an include from a specific data source. These data sources include the current XML-Offline folder, the current Pubserver or SOAP connection or the current SQL connection:

Including in CScript
#include "internal/text.h"
#include "[xml]/actions/10000.crpt"
#include "[soap]/actions/10000.crpt"
#include "[sql]/select stmt from actions where id = 10000"

For Python we want to use the language’s default import system where possible – expanding on that would mean changing the language definition, which we avoid. The default import system however is limited to very specific inputs:

  • Limited to alphanumeric characters

  • No [xml], [sql], [Pubserver] custom directives to fetch data from the current data connection

  • No relative or absolute paths

The user can work around paths with executing a more verbose import:

Importing from explicit file path in Python
import importlib.util
spec = importlib.util.spec_from_file_location("module.name", "/path/to/file.py")

foo = importlib.util.module_from_spec(spec)

spec.loader.exec_module(foo)

foo.MyClass()

This however does not solve the problem with our data pool related tokens. Since Python exposes the importer module itself and can execute it at runtime, we can provide custom functionality for importing modules from special paths:

comet.pyImport()

This function is a simple wrapper to the import module which accepts, parses and provides necessary preparation for importing modules from said data pools. The result of the function is the imported module:

Importing a Python library from an datapool specific path
myModule = comet.pyImport('[xml]/modules/myModule.py')
myModule.helloWorld()

The following datapool specific imports are supported:

Datapool imports

Syntax

Description

Comments

Example

XML files

[xml]/pID sID
<xml>/pID sID
.xml_/pID sID

[xml]/pID sName
<xml>/pID sName
xml_/pID sName

Import via the XML file panelstatements.xml.

First, the panel statement will be loaded with the ID pID.

The found command will then be executed. The first result column of this command must be a string.

In the where-condition of the command must contain exactly one ‘?’, this ‘?’ will be replaced by sID or sName.

The name may be enclosed with quotation marks but this is not necessary. The string that is found is the result of the Includes.

Include will only be executed where there is a valid XML data link.

comet.pyImport(‘.xml_/123, 4’) with Panel statement 123 “includes.xml” select stmt node includes.include where id = ?

Result of the Includes is stmt from includes.xml with the ID 4.

[xml]/path
<xml>/path
.xml_/path

Import the coded script file from the XML data folder. The path is specified relative the XML data folder.

comet.pyImport(‘.xml_/actions/1000.crpt’)

Database

[sql]/statement
<sql>/statement
.sql_/statement

Import from a database.

Include will only be executed where there is a valid database connection. The first result row of the statement must be a string or CLOB.

comet.pyImport(‘.sql_/select stmt from includes where id = 12’)

SOAP

[soap]/id
<soap>/id
.soap_/id

Import from a SOAP connection.

Include will only be executed where there is a valid SOAP connection.

comet.pyImport(‘.soap_/mystuff.cpp)’

Pubserver

[pubserver]/LibraryIdentifier.h

Import of a script library

Include is only available when connected to a PubServer

comet.pyImport(’[pubserver]/ProjectLib.h)’

[pubserver]/plugin/PluginName.c

Import of Python-Code for calling Java methods of a PubServer Plugin directly from the Python.

PluginName is the registration name of the Java Plugin.

Include is only available when connected to a PubServer

Take care to use the extension .c here.

comet.pyImport(’[pubserver]/plugins.c)’

[pubserver]/plugins.c

Import of cScript-Code for calling Java methods of all available PubServer Plugins.

Please note: plugins.c is just a meta include, which contains include directives for all available Java plug-ins.

comet.pyImport(’[pubserver]/stdlib.c)’

Function variables

Function variables follow the same syntax as in other script languages and statements. Unlike in CScript, the function variable syntax is a Python comment and the definition is thefore not removed during script execution, resulting in line numbers still being consistent when error messages come up.

There are two possible ways to access function variables in your Python scripts. Suppose you have the following function variable definition:

#pragma var "gTextColor//Text Color" "kBlack//Black" "kRed//Red" "kOrange//Orange"

Access as member of the comet module:

Any function variable is added as a direct member to the comet module itself by name.

import comet

colorValue = comet.gTextColor

Access using the global function variable list of the comet module:

Additionally, the comet module keeps a dictionary of function variables and their values.

Keys and values are always of type str

import comet

colorValue = comet.gFuncVars['gTextColor']

Note that function variable names may clash with built-in constants, modules or functions. In this case your script will fail to run. It is generally a good idea to prefix you function variable names with a unique, non-clashing identifier.

Placeholder synchronization

The module allows setting a ‘new value’ and an ‘old value’, which are only evaluated during synchronization calls. Whether or not the script is run in a synchronization call be determined using comet.getContext() which then returns constants.kContextPlaceHolderSync if that is the case.

The new value of a placeholder is the data source value which is determined for the automatic synchronization state of a placeholder (sync action ID = -1) and the value which is displayed in the ‘ToDo’ panel. Note that no changes may be made to the document when the script is executed as a synchronization call. In particular, no text may be changed through functions like CFrame.replace() and the like , since here the load scripts can be called again automatically - which can lead to endless loops.

The old value is the document value which is displayed in the document value display of the ‘ToDo’ panel. Normally this value is determined by comet automatically by extracting the value directly from the document. In certain rare cases it may be necessary to provide a different value here.

Both new and old values can be set by calling comet.setOutput() with the keys ‘gNewValue’ or ‘gOldValue’, respectively.

See here for more information: kContextPlaceHolderSync

Repeating Elements

When building repeating elements there is a number of output variables which need to be filled during the build action of the placeholder.

Variable Name

Data type

Description

gElements

list [CElement]

List of products to build

gFormat

str

Format string

The same build action can be used for synchronization purposes for repeating elements. In this case the variables in the lower table can be filled to customize the synchronization behavior.

Variable Name

Data type

Description

gPrivateSync

bool

Set the value to True, to enable your customized sync. Otherwise the default behavior is executed.

gState

int

The result state of the repeating element. Default is 1 (Okay)

gSyncChanged

bool

When manually setting the sync state, set this variable to True

gOldValue

str

The string is shown in the ToDo panel as the Document text.

gNewValue

str

The string is shown in the ToDo panel as the Data pool text.

Calling other scripts

It is possible to call other script types from Python. For this purpose there are two script functions available: comet.runJavaScript() and comet.runCScript()

The possibility on calling these depends on the host software:

InDesign® JavaScript, CScript

comet_pdf® Illustrator® CScript

CScript

CScript calls can be made using the function comet.runCScript().

This function provides automatic environment variable conversion - environment variables from comet which are available in the executing Python script are also available in the CScript.

Which variables are available and get converted depend on the execution context and are listed in the section Environment variables.

Only input variables are automatically converted.

Function variables are a special case since they provide the variable key and value as global variables, aswell as both gFuncVarNames and gFuncVarValues of type StringList.

Additionally, it is possible to provide custom variables - using the items parameter - so you can easily access your Python data in CScript.

The following table shows which types are supported and which result type to expect.

Python ➞ CScript

Source data type

Target data type

Availability

int

int

InDesign® comet_pdf® Illustrator®

float

float

InDesign® comet_pdf® Illustrator®

str

String

InDesign® comet_pdf® Illustrator®

CBook

ItemRef

InDesign®

CDocument

ItemRef

InDesign® comet_pdf® Illustrator®

CElement

Element

InDesign® comet_pdf®

CFrame

ItemRef

InDesign® comet_pdf® Illustrator®

CIDType

IDType

InDesign® comet_pdf® Illustrator®

CPageItem

ItemRef

InDesign® comet_pdf® Illustrator®

CParameter

Parameter

InDesign® comet_pdf® Illustrator®

CPlanning

Planning

InDesign® comet_pdf® Illustrator®

CProduct

Product

InDesign® comet_pdf® Illustrator®

CPublication

Publication

InDesign® comet_pdf® Illustrator®

CPublicationType

PublicationType

InDesign® comet_pdf® Illustrator®

CRect

Rect

InDesign® comet_pdf® Illustrator®

CTable

ItemRef

InDesign® comet_pdf® Illustrator®

CWorkflowStatus

WorkflowStatus

InDesign® comet_pdf® Illustrator®

list [int]

List

InDesign® comet_pdf® Illustrator®

list [float]

FloatList

InDesign® comet_pdf® Illustrator®

list [str]

StringList

InDesign® comet_pdf® Illustrator®

list [bool]

List

InDesign® comet_pdf® Illustrator®

list [CFrame]

ItemList

InDesign® comet_pdf® Illustrator®

list [CPageItem]

ItemList

InDesign® comet_pdf® Illustrator®

list [CTable]

ItemList

InDesign® comet_pdf® Illustrator®

list [CElement]

ElementList

InDesign® comet_pdf®

list [CIDType]

IDTypeList

InDesign® comet_pdf® Illustrator®

list [CParameter]

ParameterList

InDesign® comet_pdf® Illustrator®

list [CPlanning]

PlanningList

InDesign® comet_pdf® Illustrator®

list [CProduct]

ProductList

InDesign® comet_pdf® Illustrator®

list [CPublication]

PublicationList

InDesign® comet_pdf® Illustrator®

list [CPublicationType]

PublicationTypeList

InDesign® comet_pdf® Illustrator®

list [CRect]

RectList

InDesign® comet_pdf® Illustrator®

list [CWorkflowStatus]

WorkflowStatusList

InDesign® comet_pdf® Illustrator®

dict [str, str]

KeyValues

InDesign® comet_pdf® Illustrator®

All other variable types are ignored and not automatically converted.

JavaScript

When calling JavaScript from Python you may want to provide additional, non-primitive environment variables to your script. comet.runJavaScript() has an additional parameter called items which can be used to provide a list of certain Python objects which are then additionally available in the executed script.

For each object which belongs to a document, two environment variables are created: gItemRefN and gDocRefN where N is the nth object in the list, starting at 1.

e.g. when a list of three CFrame objects is provided to the items parameter you get six global variables of type ItemRef in your CScript:

gItemRef1, gItemRef2, gItemRef3, gDocRef1, gDocRef2, gDocRef3

When the provided object in items has no document, the creation of the gDocRefN parameter is omitted, but the N suffix is still increased so that when e.g. gItemRef1 has no gDocRef equivalent, gDocRef2 is the next candidate for the next document variable name.

Vice versa, when a provided object in items is a document itself, only the next gDocRef variable is created, and the gItemRef variable is omitted.

The following table shows all allowed types for entries in the items list:

Python ➞ JavaScript

Source data type

Target data type

Creates gItemRefN

Creates gDocRefN

CFrame

PageItem

CDocument

Document

CTable

Table

Environment variables

Comet provides a contingent of environment variables for your scripts to provide easy access to commonly used data, or data which is only available in certain situations.

The availability of the environment variables highly depends on the situation a Python script is executed in. e.g. an environment variable specifying a text model can not be available in a script reacting to the checkout of a publication.

All environment variables are prefixed with the letter g.

The tables below provide an exhaustive list of all environment variables per context.

The script context type can be determined by calling comet.getContext() and comparing the result to the context constants provided by the comet module: Contexts

Environment variables are seperated into two categories: Input variables and output variables.

Input variables

Input variables provide context data for the currently executing script. They are available as members of the comet module. However, they are not documented as members of the module since they are not universally available.

e.g. the input variable comet.gFrame in the context kContextPlaceHolderLoad is an instance of CFrame and represents the frame of the placeholder which is currently being loaded.

All input environment variables are read-only. Assigning them new values is undefined behavior and can lead to crashes and errors.

Output variables

Output variables are used for providing callback data to comet to drive comet’s behavior after executing a script in the current context. e.g. the output variable gTableID in the context kContextPlaceHolderLoad in a table placeholder can be set to determine which table template should be loaded.

For this purpose the comet.setOutput() must be used to set the output variables in the active context.

The provided value type must match the type required by the context and variable name according to the tables provided on a per context basis below.

Variables by context

kContextAfterLogin

kContextAfterLogin

Input variables

Variable

Data type

Description

gLogins

int

Count of successful logins since last start

kContextAllowLogin

kContextAllowLogin

Input variables

Variable

Data type

Description

gLogins

int

Count of successful logins since last start

gDBC

None

NOT IMPLEMENTED

kContextBatch

kContextBatch

Input variables

Variable

Data type

Description

gObjectPath

str

File path of the input file before moving it to the XCache.

This file does not exist anymore at this point, because it has already been moved to the XCache!

gInFile

File path of the input file in the XCache.

This is the current file you are working on!

gSourcefolder

The designated input folder

gDestfolder

The designated output folder

kContextCometTestPreScript

kContextCometTestPreScript

No environment variables.

kContextCometTestScript

kContextCometTestScript

Same as kContextCometTestPreScript

kContextCometTestPostScript

kContextCometTestPostScript

Same as kContextCometTestPreScript

kContextDocWatch

kContextDocWatch

Input variables

Variable

Data type

Description

gDocument

CDocument

The current document

gDocumentID

str

Document ID of the current document

gDocumentPath

The complete local path to the document

gDocumentPathPDF

The complete local path to the document, but with the extension pdf

gBeforeMetaData

bool

Set to true when called before document close directly before creating the metadata

kContextExtendScript

kContextExtendScript

Input variables

Variable

Data type

Description

gDocument

CDocument

The current document

gFrame

CFrame

The first selected frame

kContextPanelAction

kContextPanelAction

Input variables

Variable

Data type

Description

gDocument

CDocument

The current document

gDocumentID

str

Document ID of the current document

gRun

int

Determines the selection context this panel action is run in

gRun

Selection

Description

1 … n

At least one frame is selected.

At least one frame is selected. gRun contains the frame number

0

Nothing selected

Neither a frame not text is selected

-1

Text selected

Text tool is active and text cursor is set

gFrame

CFrame

When gRun is is not 0, this is the active frame.

gTextModel

CTextModel

When gRun is is not 0, this is the active text model.

gStart

int

When gRun is -1, this is the start index of the selected text

gLen

int

When gRun is -1, this is the length of the selected text

kContextPlaceHolderLoad

kContextPlaceHolderLoad

Input variables

Variable

Data type

Description

gDocument

CDocument

The current document

gDocumentID

str

Document ID of the current document

gFrame

CFrame

Active frame of the placeholder

gTextModel

CTextModel

Active textmodel of the placeholder

gPlaceholderID

int

ID of the placeholder

gStart

int

Start index of the text placeholder

gLen

int

Length of the text placeholder

gLink

str

For frame placeholders of the complete path on the image which is displayed in the frame. Otherwise the string is empty.

gLinkFolder

str

For frame placeholders of the path on the image, which is displayed in the frame. The path contains no path delimiter at the end. Otherwise the string is empty.

gLinkName

str

For frame placeholders of the name of the image, which are displayed in the frame. Otherwise the string is empty.

gCreated

str

Placeholders creation date and time, format YYYYMMDDHHMMSS.

gModified

str

Last time the placeholder was loaded, format YYYYMMDDHHMMSS.

gFuncVars

dict [ str, str ]

Function variables as key-value pairs. See Function variables

gRecordID

int

ID of the data record

gRecordID2

gRecordID3

gRecordStringID

str

gRecordStringID1

gRecordStringID2

gRecordStringID3

gPSRecordId

str

ID of the data record

gPSGroupId

Group ID of the data record

gPSEntityId

Identifier of the entity

gPSEntityClass

Class of the entity

gPSParentRecordId

ID of the parent of data record

gPSParentGroupId

Group ID of the parent data record

gPSParentEntityId

Identifier of the entity of the parent

gPSParentEntityClass

Class of the entity of the parent

Output variables

Variable

Data type

Description

gTableID

int

Table template ID which replaces the current text of the place holder

Only available for table placeholder load actions

gBuildTable

bool

Normally tables are build automatically after insertion into the document. If you wish to suppress this behavior, set gBuildTable to False

Only available for table placeholder load actions

gExportValue

str

If the option Behavior when loading placeholders -> Load and export to update folder is activated, placeholder contents are saved in the current update folder. For placeholders with a load script, the content of the variable gExportValue is used.

gSyncChanged

bool

The placeholder state is set to Okay after successful load scripts automatically.

In case you changed the placeholder state inside the script yourself, you can suppress this behavior by setting gSyncChanged to True

kContextPlaceHolderSync

kContextPlaceHolderSync

Input variables

Variable

Data type

Description

gDocument

CDocument

The current document

gDocumentID

str

Document ID of the current document

gFrame

CFrame

Active frame of the placeholder

gTextModel

CTextModel

Active textmodel of the placeholder

gPlaceholderID

int

ID of the placeholder

gStart

int

Start index of the text placeholder

gLen

int

Length of the text placeholder

gLink

str

For frame placeholders of the complete path on the image which is displayed in the frame. Otherwise the string is empty.

gLinkFolder

str

For frame placeholders of the path on the image, which is displayed in the frame. The path contains no path delimiter at the end. Otherwise the string is empty.

gLinkName

str

For frame placeholders of the name of the image, which are displayed in the frame. Otherwise the string is empty.

gCreated

str

Placeholders creation date and time, format YYYYMMDDHHMMSS.

gModified

str

Last time the placeholder was loaded, format YYYYMMDDHHMMSS.

gFuncVars

dict [ str, str ]

Function variables as key-value pairs. See Function variables

gRecordID

int

ID of the data record

gRecordID2

gRecordID3

gRecordStringID

str

gRecordStringID1

gRecordStringID2

gRecordStringID3

gPSRecordId

str

ID of the data record

gPSGroupId

Group ID of the data record

gPSEntityId

Identifier of the entity

gPSEntityClass

Class of the entity

gPSParentRecordId

ID of the parent of data record

gPSParentGroupId

Group ID of the parent data record

gPSParentEntityId

Identifier of the entity of the parent

gPSParentEntityClass

Class of the entity of the parent

Output variables

Variable

Data type

Description

gNewValue

str

The ‘new value’ used for synchronization purposes and the data source value in the ToDoList panel

Only available when using autosync (Use load action as sync action)

gOldValue

str

The ‘old value’ used for synchronization purposes and the document value in the ToDoList panel.

This value is usually automatically calculated and only needs to be set in rare circumstances

Only available when using autosync (Use load action as sync action)

gSyncChanged

bool

The placeholder state is set to Okay after successful load scripts automatically.

In case you changed the placeholder state inside the script yourself, you can suppress this behavior by setting gSyncChanged to True

kContextPlaceHolderStringCompare

kContextPlaceHolderStringCompare

Input variables

Variable

Data type

Description

gDocument

CDocument

The current document

gDocumentID

str

Document ID of the current document

gFrame

CFrame

Active frame of the placeholder

gTextModel

CTextModel

Active textmodel of the placeholder

gPlaceholderID

int

ID of the placeholder

gStart

Start index of the text placeholder

gLen

Length of the text placeholder

gDocumentValue

str

The text from the document

gDataPoolValue

The text from the data source

gRecordID

int

ID of the data record

gRecordID2

gRecordID3

gRecordStringID

str

gRecordStringID1

gRecordStringID2

gRecordStringID3

gPSRecordId

str

ID of the data record

gPSGroupId

Group ID of the data record

gPSEntityId

Identifier of the entity

gPSEntityClass

Class of the entity

gPSParentRecordId

ID of the parent of data record

gPSParentGroupId

Group ID of the parent data record

gPSParentEntityId

Identifier of the entity of the parent

gPSParentEntityClass

Class of the entity of the parent

kContextPlaceHolderStore

kContextPlaceHolderStore

Input variables

Variable

Data type

Description

gDocument

CDocument

The current document

gDocumentID

str

Document ID of the current document

gFrame

CFrame

Active frame of the placeholder

gTextModel

CTextModel

Active textmodel of the placeholder

gPlaceholderID

int

ID of the placeholder

gStart

int

Start index of the text placeholder

gLen

int

Length of the text placeholder

gLink

str

For frame placeholders of the complete path on the image which is displayed in the frame. Otherwise the string is empty.

gLinkFolder

str

For frame placeholders of the path on the image, which is displayed in the frame. The path contains no path delimiter at the end. Otherwise the string is empty.

gLinkName

str

For frame placeholders of the name of the image, which are displayed in the frame. Otherwise the string is empty.

gCreated

str

Placeholders creation date and time, format YYYYMMDDHHMMSS.

gModified

str

Last time the placeholder was loaded, format YYYYMMDDHHMMSS.

gFuncVars

dict [ str, str ]

Function variables as key-value pairs. See Function variables

gRecordID

int

ID of the data record

gRecordID2

gRecordID3

gRecordStringID

str

gRecordStringID1

gRecordStringID2

gRecordStringID3

gPSRecordId

str

ID of the data record

gPSGroupId

Group ID of the data record

gPSEntityId

Identifier of the entity

gPSEntityClass

Class of the entity

gPSParentRecordId

ID of the parent of data record

gPSParentGroupId

Group ID of the parent data record

gPSParentEntityId

Identifier of the entity of the parent

gPSParentEntityClass

Class of the entity of the parent

kContextPlaceHolderBuild

kContextPlaceHolderBuild

Input variables

Variable

Data type

Description

gDocument

CDocument

The current document

gDocumentID

str

Document ID of the current document

gPlaceholderID

int

ID of the placeholder

gStart

int

Start index of the text placeholder

gLen

int

Length of the text placeholder

gFrame

CFrame

Active frame of the placeholder

gLink

str

For frame placeholders of the complete path on the image which is displayed in the frame. Otherwise the string is empty.

gLinkFolder

str

For frame placeholders of the path on the image, which is displayed in the frame. The path contains no path delimiter at the end. Otherwise the string is empty.

gLinkName

str

For frame placeholders of the name of the image, which are displayed in the frame. Otherwise the string is empty.

gCreated

str

Placeholders creation date and time, format YYYYMMDDHHMMSS.

gModified

str

Last time the placeholder was loaded, format YYYYMMDDHHMMSS.

gFuncVars

dict [ str, str ]

Function variables as key-value pairs. See Function variables

gRecordID

int

ID of the data record

gRecordID2

gRecordID3

gRecordStringID

str

gRecordStringID1

gRecordStringID2

gRecordStringID3

gPSRecordId

str

ID of the data record

gPSGroupId

Group ID of the data record

gPSEntityId

Identifier of the entity

gPSEntityClass

Class of the entity

gPSParentRecordId

ID of the parent of data record

gPSParentGroupId

Group ID of the parent data record

gPSParentEntityId

Identifier of the entity of the parent

gPSParentEntityClass

Class of the entity of the parent

Output variables

Variable

Data type

Description

gElements

list [CElement]

List of elements to establish.

gFormat

str

Format string

gNewValue

str

The string is shown as data source text when the element is selected in the ToDo panel.

gOldValue

str

The string is shown as document text when the element is selected in the ToDo panel.

gPrivateSync

bool

Set the value to True if the sync calculation of the script should be used. Otherwise the default calculation for the sync status is used.

gState

int

Set the desired status of the repeating element here. See Sync states

kContextPlaceHolderBuildPost

kContextPlaceHolderBuildPost

Input variables

Variable

Data type

Description

gDocument

CDocument

The current document

gDocumentID

str

Document ID of the current document

gFrame

CFrame

Active frame of the placeholder

gPlaceholderID

int

The placeholder ID

gFrames

list [ CFrame ]

The established frames

gRecordID

int

ID of the object the placeholder is linked to

gRecordID2

gRecordID3

gRecordStringID

str

gRecordStringID1

gRecordStringID2

gRecordStringID3

gPSRecordId

str

ID of the data record

gPSGroupId

Group ID of the data record

gPSEntityId

Identifier of the entity

gPSEntityClass

Class of the entity

gPSParentRecordId

ID of the parent of data record

gPSParentGroupId

Group ID of the parent data record

gPSParentEntityId

Identifier of the entity of the parent

gPSParentEntityClass

Class of the entity of the parent

kContextPlaceHolderPrefix

kContextPlaceHolderPrefix

Input variables

Variable

Data type

Description

gDocument

CDocument

The current document

gDocumentID

str

Document ID of the current document

gFrame

CFrame

Active frame of the placeholder

gTextModel

CTextModel

The active text model of the placeholder

gStart

int

Start index of the text placeholder

gLen

int

Length of the text placeholder

gCreated

str

Placeholders creation date and time, format YYYYMMDDHHMMSS.

gModified

str

Last time the placeholder was loaded, format YYYYMMDDHHMMSS.

gPlaceholderID

int

ID of the placeholder

gRecordID

int

ID of the object the placeholder is linked to

gRecordID2

gRecordID3

gRecordStringID

str

gRecordStringID1

gRecordStringID2

gRecordStringID3

gPSRecordId

str

ID of the data record

gPSGroupId

Group ID of the data record

gPSEntityId

Identifier of the entity

gPSEntityClass

Class of the entity

gPSParentRecordId

ID of the parent of data record

gPSParentGroupId

Group ID of the parent data record

gPSParentEntityId

Identifier of the entity of the parent

gPSParentEntityClass

Class of the entity of the parent

kContextPlaceHolderPostfix

kContextPlaceHolderPostfix

Same as kContextPlaceHolderPrefix

kContextServerInterface

kContextServerInterface

Input variables

Variable

Data type

Description

gDocument

CDocument

The current document

gDocumentID

str

Document ID of the current document

gDocumentPath

The complete local path to the document

gPublicationID

ID of the publication to be processed. Empty if no publication is to be processed.

gDestinationPath

Path for an output file. Empty if not defined for this script.

gArgument

The value of the argument parameter passed to the function call.

gPublications

list [CPublication]

List of documents which are allowed to be processed in this script.

Output variables

Variable

Data type

Description

gOutput

str

This variable stores the return value of the function. Maximum length is 32MB (32 * 1024 * 1024 bytes).

kContextPODSpecialCases

kContextPODSpecialCases

Input variables

Variable

Data type

Description

gDocument

CDocument

The current document

gDocumentID

str

Document ID of the current document

gParam1
gParam2
gParam3
gParam4

str

Parameters 1-4 as str

gParamInt1
gParamInt2
gParamInt3
gParamInt4

int

Parameters 1-4 as int or 0 if the str is not convertible to an int

gParamFloat1
gParamFloat2
gParamFloat3
gParamFloat4

float

Parameters 1-4 as float or 0.0 if the str is not convertible to a float

kContextDoubleClickPreviews

kContextDoubleClickPreviews

Input variables

Variable

Data type

Description

gClicked

int

Row index of the double clicked entry

gDocumentPath

str

The complete local path to the document

gDocumentStatus

int

The document state on the server

gDocument

CDocument

The current document

gDocumentID

str

Document ID of the current document

gMasterDoc

str

Master document

gRecordID

int

ID of the document

gRecordID2

gRecordID3

gRecordStringID

str

gRecordStringID1

gRecordStringID2

gRecordStringID3

gPSRecordId

str

ID of the data record

gPSGroupId

Group ID of the data record

gPSEntityId

Identifier of the entity

gPSEntityClass

Class of the entity

gPSParentRecordId

ID of the parent of data record

gPSParentGroupId

Group ID of the parent data record

gPSParentEntityId

Identifier of the entity of the parent

gPSParentEntityClass

Class of the entity of the parent

kContextDoubleClickProductPool

kContextDoubleClickProductPool

Input variables

Variable

Data type

Description

gClicked

int

Row index of the double clicked entry

gRecordID

int

ID of the product

gRecordID2

gRecordID3

gRecordStringID

str

gRecordStringID1

gRecordStringID2

gRecordStringID3

gPSRecordId

str

ID of the data record

gPSGroupId

Group ID of the data record

gPSEntityId

Identifier of the entity

gPSEntityClass

Class of the entity

gPSParentRecordId

ID of the parent of data record

gPSParentGroupId

Group ID of the parent data record

gPSParentEntityId

Identifier of the entity of the parent

gPSParentEntityClass

Class of the entity of the parent

kContextDoubleClickPublications

kContextDoubleClickPublications

Input variables

Variable

Data type

Description

gClicked

int

Row index of the double clicked entry

gDocumentPath

str

The complete local path to the document

gDocumentStatus

int

The document state on the server

gDocument

CDocument

The current document

gDocumentID

str

Document ID of the current document

gMasterDoc

str

Master document

gRecordID

int

ID of the document

gRecordID2

gRecordID3

gRecordStringID

str

gRecordStringID1

gRecordStringID2

gRecordStringID3

gPSRecordId

str

ID of the data record

gPSGroupId

Group ID of the data record

gPSEntityId

Identifier of the entity

gPSEntityClass

Class of the entity

gPSParentRecordId

ID of the parent of data record

gPSParentGroupId

Group ID of the parent data record

gPSParentEntityId

Identifier of the entity of the parent

gPSParentEntityClass

Class of the entity of the parent

Output variables

Variable

Data type

Description

gDocumentPath

str

When this value is changed (should only be done in Panelstatement 111: Checkout), the value is used for the list entry.

gDocumentStatus

int

When this value is changed (should only be done in Panelstatement 114: Status), the value is used for the list entry.

kContextBuildSupport

kContextBuildSupport

Input variables

Variable

Data type

Description

gDocument

CDocument

The current document

gDocumentID

str

Document ID of the current document

gSituation

int

Current calling situation.

  • kSituationCheckSizeBefore: Checking the size of the template against the page element size was successful. Commit?

    return 0 : Yes

    return 1 : No. The build process will jump to the next matching page element.

    gFrames and gPreviousFrames are empty in this situation.

  • kSituationProductPlaced: The product is loaded, built and placed now. You may implement fine tuning here.

    When the product is enlarged, some frames of the product may be moved to another page element by the build process.

    The return value of the function is ignored.

  • kSituationCheckSizeAfter: Checking the size of the imported and loaded product frames against the page element was successful. Commit?

    return 0 : Yes

    return 1 : No. The build process will jump to the next matching page element.

    gFrames contains the inserted frame.

    gPreviousFrames is empty.

  • kSituationBeforeCreateContinue: At least one inserted frame can be continued. The frames have received their final position and size Now the next continuation is to be created

    gFrames contains the frames to be continued.

    gPreviousFrames is empty

  • kSituationAfterCreateContinue: A continuation template has been successfully inserted, loaded, and positioned. The frames have received their final position and size.

    gFrames contains all the frames of the continuation.

    gPreviousFrames contains the frames of the predecessor.

    The return value of the function is ignored.

  • kSituationAfterBuild: The product is now fully built and positioned.

    gFrames contains all frames including all continuations of the product.

    The return value of the function is ignored

    Attention: You can still insert new frames into the document here.

    These frames get an internal marking which causes them to be deleted automatically before reorganizations. This way it is not necessary to delete them during kSituationCheckSizeBefore

  • kSituationUnsolvableOversets: The product build checks whether oversets can be resolved using continuations.

    If after two new pages of continuations the overset has not changed, the process is cancelled.

    At the end of each product that contains such unresolvable text chains, this situation is executed.

    gFrames contains the first frame of each text chain that cannot be resolved.

  • kSituationProductFinished: Now that the product has been fully built and positioned, all text displacements and comet notes have been updated and all product frames have been combined into a new comet group.

    gFrames contains all frames including all continuations of the product.

    You can add frames here that will not become part of the comet group.

    Attention: These frames are not automatically handled by the reorganization.

gPageNum

int

1-based page number at which the build process is currently located.

gTemplateID

int

Current template resolved to page type and continuation

gTemplateName

str

gPageTemplateID

int

Current page template resolved to page type

gPageTemplateName

str

gElement

int

1-based element and element name

gElementName

str

gGridPosX

float

Current position relative to the 1:N element

gGridPosY

gElementLeft

Page relative coordinates of the current page element

gElementTop

gElementRight

gElementBottom

gFrames

list [CFrame]

List of frames as described in gSituation

gPreviousFrames

List of frames of the predecessor subtemplate filled. (only for continuations in case of kSituationAfterCreateContinue)

gProducts

list [CProduct]

Entire list of products to be built/reorganized.

gProduct

CProduct

This product is being built. The object must not be changed!

Changes to the content of the object are allowed to all attributes except:

Please note that changes may no longer have any influence on the product build process because the corresponding property has already been evaluated.

gProductCounter

int

1-based counter of built products. Page templates in the gProducts list are not counted.

kContextProductBuildPre

kContextProductBuildPre

Input variables

Variable

Data type

Description

gScriptType

int

The situation is which the script is called.

The following values are possible:

  • 1: kPreScript

  • 2: kPreRule

  • 3: kPostRule

  • 4: kExtraPlacement

  • 5: kTextflowPreScript

  • 6: kTextflowPreRule

  • 7: kTextflowPostRule

gPage

int

Current 1-based page destination number (not index) If the script creates new pages, this is also an output variable which needs to be changed

gMasterpage

str

Master page name. Use this value if you are creating new pages.

gMasterpageL

gMasterpageR

Master page name for right pages in single sided documents.

gProducts

list [ CProduct]

Complete list of products to build. This is also an output variable which can be changed.

gProduct

CProduct

Current product to place in the document, only defined inside the steps kPreRule and kPostRule.

Output variables

Variable

Data type

Description

gPage

int

Current 1-based page destination number (not index) If the script creates new pages, this needs to be updated

gProducts

list [ CProduct]

Complete list of products to build.

kContextFuncVarAvailValues

kContextFuncVarAvailValues

Input variables

Variable

Data type

Description

gDocument

CDocument

The current document

gDocumentID

str

Document ID of the current document

gFrame

CFrame

The frame of the placeholder

gVariableName

str

Name of the function variable used in the script

gVariableDisplayName

Display name of the function variable

gPlaceholderID

int

ID of the placeholder

gCallingActionID

ID of the action that called this action

Output variables

Variable

Data type

Description

gAvailableValues

list [str]

The available values for this function variable

kContextFuncVarDynamicDef

kContextFuncVarDynamicDef

Input variables

Variable

Data type

Description

gDocument

CDocument

The current document

gDocumentID

str

Document ID of the current document

gFrame

CFrame

The frame of the placeholder

gPlaceholderID

int

ID of the placeholder

gCallingActionID

ID of the action that called this action

Output variables

Variable

Data type

Description

gFuncVars

list [tuple (str, list [str])]

Full list of function variables.

The values in the list are tuples of (variable name, [variable values]), e.g.
[(‘Var2Name’, [‘Var2Value1’, ‘Var2Value2’]), (‘Var2Name’, [‘Var2Value1’, ‘Var2Value2’])]

kContextLayoutRule

kContextLayoutRule and kContextLayoutRuleCondition

Input variables

Variable

Data type

Description

gDocument

CDocument

The current document

gDocumentID

str

Document ID of the current document

gFrame

CFrame

Active frame of the layout rule

gRecordID

int

ID of the object the placeholder is linked to

gRecordID2

gRecordID3

gRecordStringID

str

gRecordStringID1

gRecordStringID2

gRecordStringID3

gPSRecordId

str

ID of the data record

gPSGroupId

Group ID of the data record

gPSEntityId

Identifier of the entity

gPSEntityClass

Class of the entity

gPSParentRecordId

ID of the parent of data record

gPSParentGroupId

Group ID of the parent data record

gPSParentEntityId

Identifier of the entity of the parent

gPSParentEntityClass

Class of the entity of the parent

gPlaceholderID

int

The placeholder ID or 0 if not linked

gLink

str

For frame placeholders of the complete path on the image which is displayed in the frame. Otherwise the string is empty.

gLinkFolder

For frame placeholders of the path on the image, which is displayed in the frame. The path contains no path delimiter at the end. Otherwise the string is empty.

gLinkName

For frame placeholders of the name of the image, which are displayed in the frame. Otherwise the string is empty.

gCreated

Placeholders creation date and time, format YYYYMMDDHHMMSS.

gModified

Last time the placeholder was loaded, format YYYYMMDDHHMMSS.

gWhen

int

Situation the script is executed in. See Layout rule situations

gParam1 … gParamN

str

Parameters of the layout rule

gFrameLeftBefore

float

Coordinates of the frame before executing the rule

gFrameTopBefore

gFrameRightBefore

gFrameBottomBefore

gOrgFrameLeft

Original coordinates (in points) of the frame when the rule was set. The coordinates are updated with every change to a rule or condition of the frame within the frame.

gOrgFrameTop

gOrgFrameRight

gOrgFrameBottom

gFrames

list [ CFrame ]

Only in calls to “after load” or “after build” rules.

After loading, the list also contains the frames that should be loaded now (e.g. the frames in the current document selection you’re loading)

After building, the list contains the frames of the inserted template.

gSender

CFrame

In a rule with the condition “Handle Event” the variable contains the frame reference to the calling frame. Otherwise the reference is empty

gKey

str

In the rule under the condition “Handle Event” the variable contains the key assigned by the sender.

gSenderData1

In an event sender two more values can be specified in addition to the key. Those parameters are passed into the variables in the handling rule and can be used there.

gSenderData2

gIsInBuild

int

In which context was the rule called?

  • 1 : Page build, Grid build, Text flow build, Clean up or reorganization

  • 0 : otherwise

gCurrentPageTemplate

If gIsInBuild == 1, the globals containing the ID of the currently used page template and (1-based) sequence number of the current page element.

gCurrentSeq

kContextLayoutRuleCondition

kContextLayoutRuleCondition

Same as kContextLayoutRule

kContextLayoutRuleDynamicList

kContextLayoutRuleDynamicList

Input variables

Variable

Data type

Description

gDocument

CDocument

The current document

gDocumentID

str

Document ID of the current document

gFrame

CFrame

Active frame of the layout rule

gRuleID

int

ID of the calling rule

gRuleName

str

Name of the calling rule

Output variables

Variable

Data type

Description

gValues

list [ str ]

The values to display in the list. These values are not translated.

gDefaultEntry

int

Index of the default entry in the list.

Bear in mind that the first two entries (“Empty” and the separator) are counted too, and that the index is 0 based. Your first actual entry has the index 2

kContextProductPoolEntries

kContextProductPoolEntries

Input variables

Variable

Data type

Description

gDocument

CDocument

The current document.

gDocumentID

str

Document ID of the current document.

gRecordID

int

ID of the parent product. This and the related values below are only filled when loading child entries of a product.

gRecordID2

gRecordID3

gRecordStringID

str

gRecordStringID1

gRecordStringID2

gRecordStringID3

gPSRecordId

ID of the parent product.

gPSGroupId

Group ID of the parent product.

gPSEntityId

Identifier of the parent product’s entity.

gPSEntityClass

Class of the parent product’s entity.

gPSParentRecordId

ID of the parent’s product’s parent.

gPSParentGroupId

Group ID of the parent’s product’s parent.

gPSParentEntityId

Identifier of the parent’s products’ entity.

gPSParentEntityClass

Class of the parent’s product’s entity

gLevel

int

Nesting depth of the parent product in the tree hierarchy.

gIconID

The icon ID of the parent product.

Output variables

Variable

Data type

Description

gProducts

list [ CProduct ]

Resulting products to display in the product pool.

kContextProductPoolSFDefaultValue

kContextProductPoolSFDefaultValue

See here for additional information.

Output variables

Variable

Data type

Description

gStatementID

int

ID of the find statement or 0 when using default search

gFieldNum

Number of the search field (1-4)

Output variables

Variable

Data type

Description

gValues

str

String for the result

kContextPublicationCheckout

kContextPublicationCheckout

Input variables

Variable

Data type

Description

gDocument

CDocument

The current document

gDocumentID

str

Document ID of the current document

gDocumentPath

str

The complete local path to the document

gDocumentStatus

int

The document state on the server

Output variables

Variable

Data type

Description

gDocumentPath

str

When this value is changed (should only be done in Panelstatement 111: Checkout), the value is used for the list entry.

gDocumentStatus

int

When this value is changed (should only be done in Panelstatement 114: Status), the value is used for the list entry.

kContextPublicationAfterSave

kContextPublicationAfterSave

Same as kContextPublicationCheckout

kContextPublicationBeforeClose

kContextPublicationBeforeClose

Same as kContextPublicationCheckout

kContextPublicationStatus

kContextPublicationStatus

Same as kContextPublicationCheckout

kContextPublicationCheckin

kContextPublicationCheckin

Same as kContextPublicationCheckout

kContextPublicationAfterClose

kContextPublicationAfterClose

Same as kContextPublicationCheckout

kContextPublicationRevert

kContextPublicationRevert

Same as kContextPublicationCheckout

kContextPublicationAfterCheckout

kContextPublicationAfterCheckout

Same as kContextPublicationCheckout

kContextURLDropActionID

kContextURLDropActionID

Input variables

Variable

Data type

Description

gFrame

CFrame

The frame at which the URL was dropped. When the drop did not occur at a frame, the value is invalid.

gDropX

float

Page-relative X position of the Drop

gDropY

float

Page-relative Y position of the Drop

gPage

CPage

Page where the drop occured

gLayer

CLayer

Layer on which the drop occured

gURL

str

The URL which was dropped

Output variables

Variable

Data type

Description

gActionID

int

The action to call for this drop.
Leave unchanged to not call any action

kContextURLDrop

kContextURLDrop

Input variables

Variable

Data type

Description

gDropX

float

Page-relative X position of the Drop

gDropY

float

Page-relative Y position of the Drop

gPage

CPage

Page where the drop occured

gLayer

CLayer

Layer on which the drop occured

gURL

str

The URL which was dropped

gFrame

CFrame

The frame at which the URL was dropped. When the drop did not occur at a frame, the value is invalid.

kContextURLLinkDestFolder

kContextURLLinkDestFolder

Input variables

Variable

Data type

Description

gDocument

CDocument

The current document

gDocumentID

str

Document ID of the current document

gURL

Complete URL of Web Image

gDestName

Local name of the image file

Output variables

Variable

Data type

Description

gDestFolder

str

Destination folder

If the string is empty, the image is placed in the default folder relative to the document, otherwise the result must contain a valid folder path. If the folder does not exist, it will be created automatically, if possible.

kContextURLLinkHeaderData

kContextURLLinkHeaderData

Input variables

Variable

Data type

Description

gURL

str

Current URL

gName

Name of the header data

Output variables

Variable

Data type

Description

gHeaderData

list [str]

Result list. Use this to store all required header data

kContextAlternativeTemplate

kContextAlternativeTemplate

Input variables

Variable

Data type

Description

gPageitemName

str

Name of the template. empty on calls out side the build process (drag and drop, …)

gPageNum

int

1-based page number to insert the template at

gPage

CPage

Page object according to gPageNum

gLayerName

str

Name of the layer on which the template is to be inserted. This is not the current layer, but the designated insertion layer

gLayer

CLayer

Layer according to gLayerName

gPositionX

float

Insertion position for the template.

Caution If the page layout is within a 1:N element, the position specifications are not always identical with the actual insertion position in the document.

The next free grid space can only be determined after the template (and its size) has been determined.

gPositionY

gGridPosX

Insertion position within a 1:N element relative to the element

Caution If the page layout is within a 1:N grid element, the position specifications are not always identical with the actual insertion position in the document.

The next free grid space can only be determined after the template (and its size) has been determined.

gGridPosY

gElementLeft

Current page element coordinates

gElementTop

gElementRight

gElementBottom

gElement

int

Current page element of the build process (1-based).

Attention With 1:N elements, multiple script calls can be made with the same element. In this case, also test the gGridPosX and gGridPosY variables.

gElementName

str

gPageTemplateID

int

Current page template of the build process.

0/empty str on calls outside of the build process (e.g. drag and drop of a product)

gPageTemplateName

str

gProducts

list [CProduct]

The variables contain the current product details during page build and reorganizations. When simply inserting templates or products, they are empty.

gProduct

CProduct

gProductCounter

int

gPageitemID

int

Current template ID. Also an output variable.

Output variables

Variable

Data type

Description

gPageitemID

int

Current template ID. If another template is to be used, the value of the variable can be changed accordingly.

kContextTableModuleInsertRow

kContextTableModuleInsertRow

Input variables

Variable

Data type

Description

gDocument

CDocument

The current document

gDocumentID

str

Document ID of the current document

gTable

CTable

Reference to the table that is being built. At the time of the call the table is reset (see CTable.reset()) and no new rows or columns have been created yet.

gColumn

int

Calling cell indices

gRow

gRootTableRecordID

int

Root-ID of the table

gRootTableRecordID2

gRootTableRecordID3

gRootTableRecordStringID

str

gColumnRecordID

int

ID of the table column

gColumnRecordID2

gColumnRecordID3

gColumnRecordStringID

str

gRowRecordID

int

ID of the table row

gRowRecordID2

gRowRecordID3

gRowRecordStringID

str

gCellRecordID

int

ID of the table cell

gCellRecordID2

gCellRecordID3

gCellRecordStringID

str

gPSRootTableRecordId

str

ID of the data record of the table

gPSRootTableGroupId

Group ID of the data record of the table

gPSRootTableEntityId

Identifier of the entity of the table

gPSRootTableEntityClass

Class of the entity of the table

gPSRootTableParentRecordId

ID of the parent data record of the table

gPSRootTableParentGroupId

Group ID of the parent data record of the table

gPSRootTableParentEntityId

Identifier of the entity of the parent of the table

gPSRootTableParentEntityClass

KClass of the entity of the parent of the table

gPSColumnRecordId

ID of the data record of the column

gPSColumnGroupId

Group ID of the data record of the column

gPSColumnEntityId

Identifier of the entity of the column

gPSColumnEntityClass

Class of the entity of the column

gPSColumnParentRecordId

ID of the parent data record of the column

gPSColumnParentGroupId

Group ID of the parent data record of the column

gPSColumnParentEntityId

Identifier of the entity of the parent of the column

gPSColumnParentEntityClass

Class of the entity of the parent of the column

gPSRowRecordId

ID of the data record of the row

gPSRowGroupId

Group ID of the data record of the row

gPSRowEntityId

Identifier of the entity of the row

gPSRowEntityClass

Class of the entity of the row

gPSRowParentRecordId

ID of the parent data record of the row

gPSRowParentGroupId

Group ID of the parent data record of the row

gPSRowParentEntityId

Identifier of the entity of the parent of the ro

gPSRowParentEntityClass

Class of the entity of the parent of the row

gPSCellRecordId

Id of the data record of the cell

gPSCellGroupId

Group Id of the data record of the cell

gPSCellEntityId

Identifier of the entity of the cell

gPSCellEntityClass

Class of the entity of the cell

gPSCellParentRecordId

ID of the parent data record of the cell

gPSCellParentGroupId

Group ID of the parent data record of the cell

gPSCellParentEntityId

Identifier of the entity of the parent of the cell

gPSCellParentEntityClass

Class of the entity of the parent of the cell

Output variables

Variable

Data type

Description

gProducts

list [ CIDType ]

Products to build by the calling hot spot cell.

gMoreGroups

list [ str ]

Additional groups of created cells.

Example:

  • Gruppe_1

  • Gruppe_1 master

  • “Gruppe 1” master

kContextTableModuleInsertColumn

kContextTableModuleInsertColumn

Same as kContextTableModuleInsertRow

kContextTableModuleLayoutRule

kContextTableModuleLayoutRule

Input variables

Variable

Data type

Description

gDocument

CDocument

The current document

gDocumentID

str

Document ID of the current document

gTable

CTable

Reference to the table that is being built.

gAreaLeft

int

Table area to work on (0-based)

gAreaRight is the first column outside this area. gAreaBottom is the first row outside this area.

gAreaTop

gAreaRight

gAreaBottom

gAlternatingColumnsOn

bool

Apply rule alternating?

gAlternatingRowsOn

gAlternatingColumnsStart

int

First row/column to work on on alternating rules.

gAlternatingRowsStart

gAlternatingColumnsStep

int

Step size for alternatings.

gAlternatingRowsStep

gGroups

str

Complete list of groups to work on resp. to exclude.

Strings are empty if Check groups is disabled for this the rule.

gNotInGroups

kContextTableModuleCellID

kContextTableModuleCellID

Same as kContextTableModuleInsertRow

kContextNoteParastyle

kContextNoteParastyle

Input variables

Variable

Data type

Description

gDocument

CDocument

The current document

gDocumentID

str

Document ID of the current document

Output variables

Variable

Data type

Description

gParastyle

str

Name of the paragraph style to be used for new Comet notes. If the value is empty or the style does not exist in the document, the values from gFontName, gFontface and gFontsize are used.

gFontname

Font for new Comet notes. If the font is empty or the font size is 0.0, the values are ignored and the default InDesign® font is used for new text frames. If the gFontface font style is empty, the Regular style is used.

gFontface

gFontsize

float

kContextNoteTargetLayer

kContextNoteTargetLayer

Input variables

Variable

Data type

Description

gDocument

CDocument

The current document

gDocumentID

str

Document ID of the current document

Output variables

Variable

Data type

Description

gLayername

str

Name of the desired target layer for completed Comet notes. For notes to be moved to this layer, the layer must exist.

kContextXMLScript

kContextXMLScript

Input variables

Variable

Data type

Description

gDocument

CDocument

The current document

gDocumentID

str

Document ID of the current document

gFrame

str

The current frame

kContextToDoListCustomTask

kContextToDoListCustomTask

Input variables

Variable

Data type

Description

gOwnerFrame

CFrame

The owning frame

gName

str

gComment

gDocumentToDo

gActionID

int

gLevel

gCometGroupID

gRecordID

int

ID of the data record

gRecordID2

gRecordID3

gRecordStringID

str

gRecordStringID1

gRecordStringID2

gRecordStringID3

gPSRecordId

ID of the data record

gPSGroupId

Group ID of the data record

gPSEntityId

Identifier of the entity

gPSEntityClass

Class of the entity

gPSParentRecordId

ID of the parent of data record

gPSParentGroupId

Group ID of the parent data record

gPSParentEntityId

Identifier of the entity of the parent

gPSParentEntityClass

Class of the entity of the parent

gProductID

int

ID of the product

gProductID2

gProductID3

gProductStringID

str

gProductStringID1

gProductStringID2

gProductStringID3

kContextPreviewsEntries

kContextPreviewsEntries

Input variables

Variable

Data type

Description

gSearchField1

str

Current values of the two search fields. Unlike PreviewStatements that execute a select statement, the contents of the search fields are not automatically extended by ‘%’ here.

gSearchField2

Output variables

Variable

Data type

Description

gProducts

list [CProduct]

List of previews to be shown

gButtonState

int

State of the load button of the preview

  • 0 : Invisible (for all products of the list gProducts)

  • 1 : Inactive (for all products of the list gProducts)

  • 2 : Visible and active (for all products of the list gProducts)

  • -1 : The value is defined with CProduct.setAttribute() with kPreviewButtonState in the individual products

gLinkScript

int

ID of the action to be executed after insertion of the entry (text or image), see here.

If you set this value to ≥ 0 it is used for all entries of the list gProducts.

Otherwise set the value individually with CProduct.setAttribute() and the slot kPreviewLinkScript.

kContextPageTemplateAfterApply

kContextPageTemplateAfterApply

Input variables

Variable

Data type

Description

gRecordID

int

ID of the preview entry which triggered the script.

Note that these IDs are normally no valid object IDs.

gRecordID2

gRecordID3

gRecordStringID

str

gRecordStringID1

gRecordStringID2

gRecordStringID3

gPSRecordId

gPSGroupId

gPSEntityId

gPSEntityClass

gPSParentRecordId

gPSParentGroupId

gPSParentEntityId

gPSParentEntityClass

gProduct

CProduct

Current, complete list of products to build, including all page templates and the current product.

Changes made on the list or the product will change the result of the build.

Only filled in calls by the product build (gScriptType = 2 or 3).

gProducts

list [CProduct]

gScriptType

int

  • 1 : Page template is set manually or with page::set_info

  • 2 : Page build

  • 3 : Page build continuation of a product

  • 6 : Call from app.comet.setTemplateID

  • 7 : Insertion of an existing 1:N page element

  • 8 : Reorganization

gPage

Current page number (not index)

Output variables

Variable

Data type

Description

gProducts

list [CProduct]

Current, complete list of products to build, including all page templates and the current product.

Changes made on the list or the product will change the result of the build.

Only filled in calls by the product build (gScriptType = 2 or 3).

kContextStampAction

kContextStampAction

Input variables

Variable

Data type

Description

gDocument

CDocument

The current document

gDocumentID

str

Document ID of the current document

gFrame

CFrame

The currently active frame

gOriginalFrame

The original frame

gCounter

int

The current stamp number

kContextExcelQueryFunction

kContextExcelQueryFunction

Input variables

Variable

Data type

Description

gRecordID

int

ID of the preview entry which triggered the script.

Note that these IDs are normally no valid object IDs.

gRecordID2

gRecordID3

gRecordStringID

str

gRecordStringID1

gRecordStringID2

gRecordStringID3

gPSRecordId

gPSGroupId

gPSEntityId

gPSEntityClass

gPSParentRecordId

gPSParentGroupId

gPSParentEntityId

gPSParentEntityClass

gExcelPath

Full path to the open Excel file.

gResultString

Contains the current text and may be changed.

gExcel

CExcelBook

The currently opened Excel file. May not be closed during the script.

Output variables

Variable

Data type

Description

gResultString

str

Contains the current text and may be changed.