Access to data and functions of the Publication Planner.
Here you will find examples to use publication.
Access to data and functions of the Publication Planner. This module provides methods to access data and functions of the Publication Planner.
static int checkin(char* documentID, char* documentPath = 0)
Check in a document.
This functions sets the environment variables required to execute publication scripts and runs Panelstatement 115 (checkin).
Usually this is just a call to the cscript function priint::checkin, but can also include other tasks such as saving publication parameters etc.
Please note the documentation of the priint::checkin function and different behaviour depending on the environment:
Name | Type | Default | Description |
Return | int | 0 or ErrorCode | |
documentID | String or char* | - | ID of the document, see DocumentID |
documentPath | String or char* | 0 | document path, optional. |
Panelstatement 53 (Before close, standard configuration with PubServer 4.0.5 Build > #370).:
int main () { int result = 0;
if (system::is_server ()) { result = publication::checkin(gDocumentID, gDocumentPath); }
return result; }
static int unsaved_commit(int behaviour)
Set behaviour when committing unsaved documents.
Typically, this function is called in a login script to control the behaviour, when unsaved documents are
checked in.
Valid options are:
Name | Type | Default | Description |
Return | int | 0 or ErrorCode | |
behaviour | int | - | kRevert, kDeny oder kAutosave, see above for details |
static int checkout(char* documentID, char* documentPath = 0)
Check out a document.
This functions sets the environment variables required to execute publication scripts and runs Panelstatement 111 (checkout).
Usually this is just a call to the cscript function priint::checkout, which actually checks out the document, but can also include other tasks.
Please note:
Name | Type | Default | Description |
Return | int | 0 or ErrorCode | |
documentID | String or char* | - | ID of the document, see DocumentID |
documentPath | String or char* | 0 | document path, optional. |
static int checkout_clicked(int listIndex)
Check out a document.
This functions sets the environment variables required to execute publication scripts and runs Panelstatement 111 (checkout).
The InDesign® Server implementation is empty
Name | Type | Default | Description |
Return | int | 0 or ErrorCode | |
listIndex | int | - | list index of the document in the publication panel. This must be a valid document entry. |
static int checkout_by_id(
char* documentId,
int id1 = 2,
int id2 = 0,
int id3 = 0,
int convert = 0)
Check out a document using the document ID
This function defines the environment variables required for publication scripts and executes Panelstatement 111 (Checkout)
Please note: this function allows to checkout documents independently of the Publication panel, this means: most of the values usually defined for publication
nodes in the panel (such as status, info1, info2 etc.) are not available, if checkout is triggered by calling this function.
Usually these values aren't required for checkout scripts either; the checkout script included in the standard delivery for examples refers to the
ID attributes of publication nodes only, i.e. id1, id2, id3 and StringID, the latter being used as the publication nodes document Id
Documents, which are managed in the priint:planner use the id1 attribute for the document-type, possible values are
If you intent to use this functions to checkout other documents (i.e. documents not managed with priint:planner or documents not provided by the standard CometPublication PlugIn), you must double-check these values, shortly speaken: all IDs must match the values of the corresponing publication node, if it was loaded / shown in the publication panel.
If the document is already checked out, it will just be opened from the file system resp. be brought to front.
Please note also: In InDesign® Server and PDF Renderer the function implementation is empty
Name | Type | Default | Description |
Return | int | 0 or ErrorCode | |
documentId | char * | - | Id of the document in the publication system |
id1 | int | 2 | numeric id1 of the document, usually used for the document type |
id2 | int | 0 | numeric id2 of the document |
id3 | int | 0 | numeric id3 of the document |
convert | int | 0 | how to handle documents created with outdated versions: 0 - automatically convert, 1 - do not convert, 2 - show dialog and ask |
static int checkin_by_id(
char* documentId,
int id1 = 2,
int id2 = 0,
int id3 = 0)
Check in a document using the document ID
This function defines the environment variables required for publication scripts and executes Panelstatement 115 (Checkin)
Please note: this function allows to checkin documents independent of the Publication panel, this means: most of the values usually defined for publication
nodes in the panel (such as status, info1, info2 etc.) are not available, if checkin is triggered by calling this function.
Usually these values aren't required for checkin scripts either; the statement included in the standard delivery for examples refers to the
global variable gDocumentID only, which is available independently from the publication panel.
ID attributes of publication nodes only, i.e. id1, id2, id3 and StringID, the latter being used as the publication nodes document Id
Documents, which are managed in the priint:planner use the id1 attribute for the document-type, possible values are
If you intent to use this functions to checkin other documents (i.e. documents not managed with priint:planner or documents not provided by the standard CometPublication PlugIn), you must double-check these values, shortly speaken: all IDs must match the values of the corresponing publication node, if it was loaded / shown in the publication panel.
Please note also: In InDesign® Server and PDF Renderer the function implementation is empty.
Name | Type | Default | Description |
Return | int | 0 or ErrorCode | |
documentId | char * | - | Id of the document in the publication system |
id1 | int | 2 | numeric id1 of the document, usually used for the document type |
id2 | int | 0 | numeric id2 of the document |
id3 | int | 0 | numeric id3 of the document |
static int revert(char* documentId, char* documentPath = 0)
Revert a checked out document defined by its documentId. Local changes made to the document will be lost.
The function sets the environment variables required for publication scripts and executes panel statement 117 then.
This functions requires a connection to a priint:comet Server. In InDesign® Server and PDF Renderer the function implementation is empty.
Name | Type | Default | Description |
Return | int | 0 or ErrorCode | |
documentID | String or char* | - | ID of the document, see DocumentID |
documentPath | String or char* | 0 | document path, optional. |
static int revert_by_id(
char* documentId,
int id1 = 2,
int id2 = 0,
int id3 = 0)
Revert a checked out document defined by its documentId. Local changes made to the document will be lost.
Documents, which are managed in the priint:planner use the id1 attribute for the document-type, possible values are
If you intent to use this functions to checkin other documents (i.e. documents not managed with priint:planner or documents not provided by the standard CometPublication PlugIn), you must double-check these values, shortly speaken: all IDs must match the values of the corresponing publication node, if it was loaded / shown in the publication panel.
This functions requires a connection to a priint:comet Server. In InDesign® Server and PDF Renderer the function implementation is empty.
Name | Type | Default | Description |
Return | int | 0 or ErrorCode | |
documentId | char * | - | Id of the document in the publication system |
id1 | int | 2 | numeric id1 of the document, usually used for the document type |
id2 | int | 0 | numeric id2 of the document |
id3 | int | 0 | numeric id3 of the document |
static int aftercheckout(char* documentID, char* documentPath = 0)
After check out a document.
This functions sets the environment variables required to execute publication scripts and runs Panelstatement 125 (after checkout).
Usually this statement includes document initialization, such as reading and setting document parameters, which require a checked out and opened document.
The implementation of this function on InDesign® Desktop is empty, because Panelstatement 125 will be run automatically after checking out a document (either by click in the panel or by calling publication::checkout_clicked)
Name | Type | Default | Description |
Return | int | 0 oder Fehlercode | |
documentID | String or char* | - | ID of the document, see DocumentID |
documentPath | String or char* | 0 | document path, optional. |
Panelstatement 44 (After open, standard configuration with PubServer 4.0.5 Build > #370).:
int main () { int result = 0;
if (system::is_server ()) { result = publication::aftercheckout(gDocumentID, gDocumentPath); }
return result; }
static int aftersave(char* documentID, char* documentPath = 0)
After saving a publication document.
This functions sets the environment variables required to execute publication scripts and runs Panelstatement 112 (after save).
Usually this statement is empty, unless there are special requirements to react on (just) saving publication documents.
Name | Type | Default | Description |
Return | int | 0 oder Fehlercode | |
documentID | String or char* | - | ID of the document, see DocumentID |
documentPath | String or char* | 0 | document path, optional. |
Panelstatement 48 (After save, standard configuration with PubServer 4.0.5 Build > #370).:
int main () { int result = 0;
if (system::is_server ()) { result = publication::aftersave(gDocumentID, gDocumentPath); }
return result; }
static char* get_property(char* documentId, char* propertyName)
Get property of a publication or a document. See the example "Publication properties".
Only available when connected to a PubServer >= V4.0.5 Build #585
Name | Type | Default | Description |
Return | char * | value of the property or 0 on errors. The result string is valid until the next time this function is called and must not be changed or released. | |
documentId | String or char* | 0 | Document ID. If set to 0, the document ID is determined from the current front document. |
propertyName | String or char* | - | name of the property, e.g. "description" |
static int set_property(
char* documentId,
char* propertyName,
char* propertyValue)
Set property of a publication or a document. ee the example "Publication properties".
Only available when connected to a PubServer >= V4.0.5 Build #585
Name | Type | Default | Description |
Return | int | 0 or ErrorCode | |
documentId | String or char* | - | Document ID. If set to 0, the document ID is determined from the current front document. |
propertyName | String or char* | - | name of the property, e.g. "description" |
propertyValue | String or char* | - | New value of this property |
static char* get_label(char* documentId)
Get label of a publication or a document. This is a shortcut for publication::get_property (documentId, "label2"), see the example "Publication properties".
Only available when connected to a PubServer >= V4.0.5 Build #585
Name | Type | Default | Description |
Return | char * | label or 0 on errors. The result string is valid until the next time this function is called and must not be changed or released. | |
documentId | String or char* | 0 | Document ID. If set to 0, the document ID is determined from the current front document. |
static int set_label(char* documentId, char* label)
Set label of a publication or a document. This is a shortcut for publication::get_property (documentId, "label2", value), see the example "Publication properties".
Only available when connected to a PubServer >= V4.0.5 Build #585
Name | Type | Default | Description |
Return | int | 0 or ErrorCode | |
documentId | String or char* | 0 | Document ID. If set to 0, the document ID is determined from the current front document. |
label | String or char* | - | new label |
static StringList get_parameters(char* documentID)
Get the parameters of a publication document.
The parameters are returned as StringList, each containing a key and a value as the following el##x65;ment:
Keys and values can be read with methods of the class StringList and e.g. transferred to the document.
Name | Type | Default | Description |
Return | StringList | Newly allocated object of the StringList class. This list must be released again with stringlist::release. | |
documentID | String or char* | - | ID of the document, see DocumentID |
static int apply_parameters(ItemRef documentRef, char* documentID = 0)
Fetch the parameters of a publication document and apply them as attributes to the XML Root of the document.
Name | Type | Default | Description |
Return | int | 0 oder error code | |
documentRef | ItemRef | - | Document to apply the parameters to |
documentID | String oder char* | - | ID of the document, see DocumentID |
static int set_parameter(
char* documentId,
char* parameterIdentifier,
char* value1,
char* value2 = 0,
char* value3 = 0)
Set parameter of a publication or a document.
Only available when connected to a PubServer >= V4.0.5 Build #585
Name | Type | Default | Description |
Return | int | 0 or ErrorCode | |
documentId | String or char* | 0 | Document ID. If set to 0, the document ID is determined from the current front document. |
parameterIdentifier | String or char* | - | parameter identifier |
value1 | String or char* | - | first value of parameter |
value2 | String or char* | 0 | second value of parameter, if 0 only 1 parameter value is set |
value3 | String or char* | 0 | third value of parameter, if 0 only 1 resp. 2 values are set |
static char* get_rootpublication_id(char* documentId = 0)
Get ID of the root publication of a publication or document.
Only available when connected to a PubServer >= V4.0.5 Build #585
Name | Type | Default | Description |
Return | char * | ID or 0 on errors. The result string is valid until the next time this function is called and must not be changed or released. | |
documentId | String or char* | 0 | Document ID. If set to 0, the document ID is determined from the current front document. |
static char* get_publication_path(char* documentId = 0)
Get path (folder) of a publication
Only available when connected to a PubServer >= V4.1.5 Build #940
Name | Type | Default | Description |
Return | char * | Path or 0 on errors. The result string is valid until the next time this function is called and must not be changed or released. | |
publicationId | String or char* | 0 | Publication Id |
static PublicationList collect_documents(char* publicationId, int levels = -1)
Collect all documents of a publication in levels sub levels
Only available when connected to a PubServer >= V4.1.5 Build #940
Name | Type | Default | Description |
Return | PublicationList * | PublicationList or 0 on errors. | |
publicationId | String or char* | 0 | Publication Id |
levels | int | -1 | How many levels? -1 for all |
static char* get_publication_id(char* documentId = 0)
Get publication ID of a document.
Only available when connected to a PubServer >= V4.0.5 Build #585
Name | Type | Default | Description |
Return | char * | ID or 0 on errors. The result string is valid until the next time this function is called and must not be changed or released. | |
documentId | String or char* | 0 | Document ID. If set to 0, the document ID is determined from the current front document. |
static PublicationList get_tree(char* parentId = 0)
static PublicationList get_subnodes(char* parentId = 0)
Get the subelements of a publication.
Only available when connected to a PubServer >= V4.0.5 Build #585
Name | Type | Default | Description |
Return | PublicationList | publication list or 0 on errors. The list must be released with publication::publicationlist::release. | |
parentId | String or char* | 0 | ID of the parent node. If 0, the top level publicationsget_re (root elements) are returned. |
static PublicationList get_master_documents()
Get list of document templates.
Only available when connected to a PubServer >= V4.0.5 Build #585
Name | Type | Default | Description |
Return | PublicationList | publication list or 0 on errors. The list must be released with publication::publicationlist::release. |
static PublicationList search(
char* rootPublicationId = 0,
char* subPublicationId = 0,
char* docName = 0,
char* workflowStatusId1 = 0,
char* workflowStatusId2 = 0,
char* workflowStatusId3 = 0,
char* param1 = 0,
char* value11 = 0,
char* value12 = 0,
char* value13 = 0,
char* param2 = 0,
char* value21 = 0,
char* value22 = 0,
char* value23 = 0,
char* param3 = 0,
char* value31 = 0,
char* value32 = 0,
char* value33 = 0,
int restrictiveCheckbox = 0,
int recursive = 0)
Search for documents. The more parameters are set the less is found. If called without any parameters, just all existing documents are returned.
Only available when connected to a PubServer >= V4.0.5 Build #585
Name | Type | Default | Description |
Return | PublicationList | publication list or 0 on errors. The list must be released with publication::publicationlist::release | |
rootPublicationId | String or char* | 0 | |
subPublicationId | String or char* | 0 | |
docName | String or char* | 0 | |
workflowStatusId1 | String or char* | 0 | |
workflowStatusId2 | String or char* | 0 | |
workflowStatusId3 | String or char* | 0 | |
param1 | String or char* | 0 | |
value11 | String or char* | 0 | |
value12 | String or char* | 0 | |
value13 | String or char* | 0 | |
param2 | String or char* | 0 | |
value21 | String or char* | 0 | |
value22 | String or char* | 0 | |
value23 | String or char* | 0 | |
param3 | String or char* | 0 | |
value31 | String or char* | 0 | |
value32 | String or char* | 0 | |
value33 | String or char* | 0 | |
restrictiveCheckbox | int | - | |
recursive | int | - |
static ProductList get_document_product_selection(char* documentId = 0)
Get list of products scheduled for this document.
Only available when connected to a PubServer >= V4.0.5 Build #585
Name | Type | Default | Description |
Return | ProductList | list of scheduled products. This list can be used to generate the document e.g. using productlist::establish | |
documentId | String or char* | 0 | Document ID. If set to 0, the document ID is determined from the current front document. |
static ProductList get_document_product_planning(
char* documentId = "",
char* entityIdentifier = "",
char* searchString = "",
int mappingFlag = 0)
Get list of products scheduled for this document (new planning tool).
Only available when connected to a PubServer >= V4.0.5 Build #1920
Name | Type | Default | Description |
Return | ProductList | List of scheduled products. This list can be used to generate the document e.g. using productlist::establish The list must be released again with productlist::release. |
|
documentId | String or char* | 0 | Document ID. If set to 0, the document ID is determined from the current front document. |
entityIdentifier | String or char* | "" | limit to products of this entity type |
searchString | String or char* | "" | limit to products matching the given search criteria |
mappingFlag | int | 0 | flag for mapping 0 = use IDs of the planned Bucket 1 = use IDs of the Planning record 2 = use IDs of planned Bucket and ID of the Planning record as parent |
static WorkflowStatusList get_workflow_states()
Get all document workflow states.
Only available when connected to a PubServer >= V4.0.5 Build #585
Name | Type | Default | Description |
Return | WorkflowStatusList | WorkflowStatus list or 0 on errors. The list must be released with publication::workflowstatuslist::release. |
static WorkflowStatusList get_document_workflow_states(char* documentId = 0)
Get workflow states for a document.
Only available when connected to a PubServer >= V4.0.5 Build #585
Name | Type | Default | Description |
Return | WorkflowStatusList | WorkflowStatus list or 0 on errors. The list must be released with publication::workflowstatuslist::release. | |
documentId | String or char* | 0 | Document ID. If omitted or 0, the document ID is determined from the current front document. |
static WorkflowStatusList get_document_workflow_status(char* documentId = 0)
Get current workflow status for a document.
Only available when connected to a PubServer >= V4.0.5 Build #585
Name | Type | Default | Description |
Return | WorkflowStatus | WorkflowStatus or 0 on errors. The object must be released with publication::workflowstatus::release. | |
documentId | String or char* | 0 | Document ID. If omitted or 0, the document ID is determined from the current front document. |
static int set_document_workflow_status(
char* documentId,
char* actionId,
char* url)
Set workflow status for a document.
Only available when connected to a PubServer >= V4.0.5 Build #585
Name | Type | Default | Description |
Return | int | 0 or ErrorCode | |
documentId | String or char* | 0 | Document ID. If set to 0, the document ID is determined from the current front document. |
actionId | String or char* | - | ID of the next TODO step. This is not the ID of the WorkflowStatus object, but the actionId. See notes at publication::workflowstatus::gets |
url | String or char* | 0 |
static WorkflowStatusList get_next_workflow_states(char* documentId = 0)
Get next workflow states for a document. Objects in this list also include the actionId, i.e. the concrete ID of the next TODO step.
Only available when connected to a PubServer >= V4.0.5 Build #585
Name | Type | Default | Description |
Return | WorkflowStatusList | WorkflowStatus list or 0 on errors. The list must be released with publication::workflowstatuslist::release. | |
documentId | String or char* | 0 | Document ID. If omitted or 0, the document ID is determined from the current front document. |
static PublicationTypeList get_publication_types()
Get list of available publication types
Only available when connected to a PubServer >= V4.0.5 Build #585
Name | Type | Default | Description |
Return | PublicationTypeList | PublicationType list or 0 on errors. The list must be released with publication::publicationtypelist::release. |
static ParameterList get_all_parameters()
Get list of available parameters
Only available when connected to a PubServer >= V4.0.5 Build #585
Name | Type | Default | Description |
Return | ParameterList | ParameterList list or 0 on errors. The list must be released with publication::parameterlist::release. |
static ParameterList get_parameter_values(int parameterId)
Get list values of a parameter of type kTypeCombo
Only available when connected to a PubServer >= V4.0.5 Build #585
Name | Type | Default | Description |
Return | ParameterList | ParameterList list or 0 on errors. The list must be released with publication::parameterlist::release. | |
parameterId | int | - | ID of the parameter |
static char* get_parameter_from_document(ItemRef document, char* parameterIdentifier)
Read value of a parameter from document
Only available when connected to a PubServer >= V4.0.5 Build #585
Name | Type | Default | Description |
Return | char * | label or 0 on errors. The result string is valid until the next time this function is called and must not be changed or released. | |
documentId | ItemRef | - | document ref. 0 = current front document |
parameterIdentifier | String or char* | - | parameter identifier |
static int release(Publication publication)
Release a Publication object
Name | Type | Default | Description |
publication | Publication | - | object to release |
static int get(Publication publication, int selector)
Get the Integer property of a Publication object.
Name | Type | Default | Description |
Return | int | (Integer) property of this object determined by selector | |
publication | Publication | - | publication object |
selector | int | - | which property? Valid values are kID kID2 kID3 kCanOverrideURL kCanOverrideLocal kStatementId kIconId kHasChildren |
static int set(
Publication publication,
int selector,
int value)
Set the Integer property of a Publication object.
Name | Type | Default | Description |
publication | Publication | - | publication object |
selector | int | - | which property? Valid values are kID kID2 kID3 kCanOverrideURL kCanOverrideLocal kStatementId kIconId kHasChildren |
value | int | - | new value for the given property |
static char* gets(Publication publication, int selector)
Get a String property of a Publication object.
Name | Type | Default | Description |
Return | char * | (String) property of this object determined by selector | |
publication | Publication | - | Publication object |
selector | int | - | which property? Valid values are kStringID kDocumentId (Alias for kStringId) kInfo kName kLabel (Alias for kName) kType kStatus kInfo1 kInfo2 kDomain kPath kUrl |
static char* sets(
Publication publication,
int selector,
char* value)
Set a String property of a Publication object.
Name | Type | Default | Description |
publication | Publication | - | Publication object |
selector | int | - | which property? Valid values are kStringID kDocumentId (Alias for kStringId) kInfo kName kLabel (Alias for kName) kType kStatus kInfo1 kInfo2 kDomain kPath kUrl |
value | - | char * or String | new value for the given property |
static char* to_xml(Publication publication, char* rootElementName = "publication")
Generate a XML structure of a Publication object.
If you think about using this function, you might be interested in further information about cscript / java interaction. Related information can be found here.
Name | Type | Default | Description |
Return | char * | xml string or 0 on errors. The result string is valid until the next time a to_xml function is called and must not be changed or released. | |
publication | Publication | - | object |
rootElementName | String or char* | publication | name of the root element |
static Publication from_xml(char* xml)
Create a Publication object from a xml structure.
If you think about using this function, you might be interested in further information about cscript / java interaction. Related information can be found here.
Name | Type | Default | Description |
Return | Publication | object of type Publication. This object must be released using publication::release. | |
xml | String or char* | - | xml structure |
static Publication alloc()
Create a new, empty Publication object.
Name | Type | Default | Description |
Return | Publication | object of type Publication. This object must be released using publication::release. |
static int copy(Publication destination, Publication source)
Copy all values from object source to object destination.
Name | Type | Default | Description |
Return | int | 0 or ErrorCode | |
destination | Publication | - | destination object |
destination | Publication | - | source object |
static PublicationList publicationlist::alloc()
Create a new, empty PublicationList object.
Name | Type | Default | Description |
Return | PublicationList | object of type PublicationList. This object must be released using publication::publicationlist::release. |
static int publicationlist::release(PublicationList list)
Release a PublicationList.
Name | Type | Default | Description |
list | PublicationList | - | list to release |
static int publicationlist::length(PublicationList list)
Get the length of a publication list
Name | Type | Default | Description |
Return | int | list length | |
list | PublicationList | - | list |
static Publication publicationlist::get(PublicationList list, int n)
Get the nth Publication from this PublicationList. Index must be within { 0 .. list length - 1 }.
Name | Type | Default | Description |
Return | Publication | Publication object | |
list | Publication | -List | list |
n | int | - | index of list element |
static char* publicationlist::to_xml(PublicationList list, char* rootElementName = "publications")
Generate a XML structure of a PublicationList object.
If you think about using this function, you might be interested in further information about cscript / java interaction. Related information can be found here.
Name | Type | Default | Description |
Return | char * | xml string or 0 on errors. The result string is valid until the next time a to_xml function is called and must not be changed or released. | |
list | PublicationList | - | list object |
rootElementName | String or char* | publications | name of the root element |
static PublicationList publicationlist::from_xml(char* xml)
Create a PublicationList object from a xml structure.
If you think about using this function, you might be interested in further information about cscript / java interaction. Related information can be found here.
Name | Type | Default | Description |
Return | PublicationList | list of type PublicationList. This list must be released using publicationlist::release. | |
xml | String or char* | - | xml structure |
static int publicationlist::add_all(
PublicationList target,
PublicationList src,
int deleteFromSource)
Append all elements from list src to list target. If deleteFromSource is non-zero, all elements are removed from source list. (but not deleted)
Name | Type | Default | Description |
Return | int | 0 oder Fehlercode. | |
target | PublicationList - | target list | |
src | PublicationList - | source list | |
deleteFromSource | 0 | delete elements from source |
static ParameterList parameterlist::alloc()
Create a new, empty ParameterList object.
Name | Type | Default | Description |
Return | ParameterList | object of type ParameterList. This object must be released using publication::parameterlist::release. |
static int parameterlist::release(ParameterList list)
Release a ParameterList.
Name | Type | Default | Description |
list | ParameterList | - | list to release |
static int parameterlist::length(ParameterList list)
Get the length of a parameter list
Name | Type | Default | Description |
Return | int | list length | |
list | ParameterList | - | list |
static Parameter parameterlist::get(ParameterList list, int index)
Get the nth Parameter from this ParameterList. Index must be within { 0 .. list length - 1 }.
Name | Type | Default | Description |
Return | Parameter | Parameter object | |
list | - | ParameterList | list |
n | int | - | index of list element |
static char* parameterlist::to_xml(ParameterList list, char* rootElementName = "parameters")
Generate a XML structure of a ParameterList object.
If you think about using this function, you might be interested in further information about cscript / java interaction. Related information can be found here.
Name | Type | Default | Description |
Return | char * | xml string or 0 on errors. The result string is valid until the next time a to_xml function is called and must not be changed or released. | |
list | ParameterList | - | list object |
rootElementName | String or char* | parameters | name of the root element |
static ParameterList parameterlist::from_xml(char* xml)
Create a ParameterList object from a xml structure.
If you think about using this function, you might be interested in further information about cscript / java interaction. Related information can be found here.
Name | Type | Default | Description |
Return | ParameterList | list of type ParameterList. This list must be released using parameterlist::release. | |
xml | String or char* | - | xml structure |
static int parameterlist::add_all(
ParameterList target,
ParameterList src,
int deleteFromSource)
Append all elements from list src to list target. If deleteFromSource is non-zero, all elements are removed from source list. (but not deleted)
Name | Type | Default | Description |
Return | int | 0 or Error Code. | |
target | ParameterList | - | target list |
src | ParameterList | - | source list |
deleteFromSource | int | 0 | delete elements from source |
static Parameter parameter::alloc()
Create a new, empty Parameter object.
Name | Type | Default | Description |
Return | Parameter | object of type Parameter. This object must be released using publication::parameter::release. |
static int parameter::release(Parameter parameter)
Release a Parameter object
Name | Type | Default | Description |
parameter | - | Parameter | object to release |
static int parameter::get(Parameter parameter, int selector)
Get the Integer property of a Parameter object.
Name | Type | Default | Description |
Return | int | (Integer) property of this object determined by selector | |
parameter | Publication | - | Publication object |
selector | int | - | which property? Valid values are kID kType (kTypeText, kTypeCombo or kTypeCheckbox) |
static char* parameter::gets(Parameter parameter, int selector)
Get a String property of a Parameter object.
Name | Type | Default | Description |
Return | char * | (String) property of this object determined by selector | |
parameter | - | Parameter | Parameter object |
selector | int | - | which property? Valid values are kStringID kName kLabel (Alias for kName) kValue1 kValue2 kValue3 |
static char* parameter::to_xml(Parameter parameter, char* rootElementName = "parameter")
Generate a XML structure of a Parameter object.
If you think about using this function, you might be interested in further information about cscript / java interaction. Related information can be found here.
Name | Type | Default | Description |
Return | char * | xml string or 0 on errors. The result string is valid until the next time a to_xml function is called and must not be changed or released. | |
parameter | Parameter- | object | |
rootElementName | String or char* | parameter | name of the root element |
static Parameter parameter::from_xml(char* xml)
Create a Parameter object from a xml structure.
If you think about using this function, you might be interested in further information about cscript / java interaction. Related information can be found here.
Name | Type | Default | Description |
Return | Parameter | object of type Parameter. This object must be released using parameter::release. | |
xml | String oder char* | - | xml structure |
static int parameter::copy(Parameter destination, Parameter source)
Copy all values from object source to object destination.
Name | Type | Default | Description |
Return | int | 0 or ErrorCode | |
destination | Parameter | - | destination object |
destination | Parameter | - | source object |
static PublicationTypeList publicationtypelist::alloc()
Create a new, empty PublicationTypeList object.
Name | Type | Default | Description |
Return | PublicationTypeList | object of type PublicationTypeList. This object must be released using publication::publicationtypelist::release. |
static int publicationtypelist::release(PublicationTypeList list)
Release a PublicationTypeList.
Name | Type | Default | Description |
list | PublicationTypeList | - | list to release |
static int publicationtypelist::length(PublicationTypeList list)
Get the length of a PublicationType list
Name | Type | Default | Description |
Return | int | list length | |
list | PublicationTypeList | - | list |
static PublicationType publicationtypelist::get(PublicationTypeList list, int index)
Get the nth PublicationType from this PublicationTypeList. Index must be within { 0 .. list length - 1 }.
Name | Type | Default | Description |
Return | PublicationType | PublicationType object | |
list | Publication | -TypeList | list |
n | int | - | index of list element |
static char* publicationtypelist::to_xml(PublicationTypeList list, char* rootElementName = "publicationtypes")
Generate a XML structure of a PublicationTypeList object.
If you think about using this function, you might be interested in further information about cscript / java interaction. Related information can be found here.
Name | Type | Default | Description |
Return | char * | xml string or 0 on errors. The result string is valid until the next time a to_xml function is called and must not be changed or released. | |
list | PublicationTypeList | - | list object |
rootElementName | String or char* | publicationtypes | name of the root element |
static PublicationTypeList publicationtypelist::from_xml(char* xml)
Create a PublicationTypeList object from a xml structure.
If you think about using this function, you might be interested in further information about cscript / java interaction. Related information can be found here.
Name | Type | Default | Description |
Return | PublicationTypeList | list of type PublicationTypeList. This list must be released using publicationtypelist::release. | |
xml | String or char* | - | xml structure |
static int publicationtypelist::add_all(
PublicationTypeList target,
PublicationTypeList src,
int deleteFromSource)
Append all elements from list src to list target. If deleteFromSource is non-zero, all elements are removed from source list. (but not deleted)
Name | Type | Default | Description |
Return | int | 0 oder Fehlercode. | |
target | PublicationTypeList - | target list | |
src | PublicationTypeList - | source list | |
deleteFromSource | 0 | delete elements from source |
static PublicationType publicationtype::alloc()
Create a new, empty PublicationType object.
Name | Type | Default | Description |
Return | PublicationType | object of type PublicationType. This object must be released using publication::publicationtype::release. |
static int publicationtype::release(PublicationType publicationType)
Release a PublicationType object
Name | Type | Default | Description |
publicationType | Publication | -Type | object to release |
static char* publicationtype::gets(PublicationType publicationType, int selector)
Get a String property of a PublicationType object.
Name | Type | Default | Description |
Return | char * (String) | property of this object determined by selector | |
publicationType | Publication | - | Type PublicationType object |
selector | int | - | Which property? Valid values are kStringID kID (Alias for kStringID) kName kLabel (Alias for kName) |
static char* publicationtype::to_xml(PublicationType publicationtype, char* rootElementName = "publicationtype")
Generate a XML structure of a PublicationType object.
If you think about using this function, you might be interested in further information about cscript / java interaction. Related information can be found here.
Name | Type | Default | Description |
Return | char * | xml string or 0 on errors. The result string is valid until the next time a to_xml function is called and must not be changed or released. | |
publicationtype | PublicationType | - | object |
rootElementName | String or char* | publicationtype | name of the root element |
static PublicationType publicationtype::from_xml(char* xml)
Create a PublicationType object from a xml structure.
If you think about using this function, you might be interested in further information about cscript / java interaction. Related information can be found here.
Name | Type | Default | Description |
Return | PublicationType | object of type PublicationType. This object must be released using publicationtype::release. | |
xml | String or char* | - | xml structure |
static int publicationtype::copy(PublicationType destination, PublicationType source)
Copy all values from object source to object destination.
Name | Type | Default | Description |
Return | int | 0 or ErrorCode | |
destination | PublicationType | - | destination object |
destination | PublicationType | - | source object |
static WorkflowStatusList workflowstatuslist::alloc()
Create a new, empty WorkflowStatusList object.
Name | Type | Default | Description |
Return | WorkflowStatusList | object of type WorkflowStatusList. This object must be released using publication::workflowstatuslist::release. |
static int workflowstatuslist::release(WorkflowStatusList list)
Release a WorkflowStatusList.
Name | Type | Default | Description |
list | WorkflowStatusList | - | list to release |
static int workflowstatuslist::length(WorkflowStatusList list)
Get the length of a WorkflowStatus list
Name | Type | Default | Description |
Return | int | list length | |
list | WorkflowStatusList | - | list |
static WorkflowStatus workflowstatuslist::get(WorkflowStatusList list, int index)
Get the nth WorkflowStatus from this WorkflowStatusList. Index must be within { 0 .. list length - 1 }.
Name | Type | Default | Description |
Return | WorkflowStatus | WorkflowStatus object | |
list | - | WorkflowStatusList | list |
n | int | - | index of list element |
static char* workflowstatuslist::to_xml(WorkflowStatusList list, char* rootElementName = "workflowstates")
Generate a XML structure of a WorkflowStatus object.
If you think about using this function, you might be interested in further information about cscript / java interaction. Related information can be found here.
Name | Type | Default | Description |
Return | char * | xml string or 0 on errors. The result string is valid until the next time a to_xml function is called and must not be changed or released. | |
list | WorkflowStatusList | - | list object |
rootElementName | String or char* | workflowstates | name of the root element |
static WorkflowStatusList workflowstatuslist::from_xml(char* xml)
Create a WorkflowStatusList object from a xml structure.
If you think about using this function, you might be interested in further information about cscript / java interaction. Related information can be found here.
Name | Type | Default | Description |
Return | WorkflowStatusList | list of type WorkflowStatusList. This list must be released using workflowstatuslist::release. | |
xml | String or char* | - | xml structure |
static int workflowstatuslist::add_all(
WorkflowStatusList target,
WorkflowStatusList src,
int deleteFromSource)
Append all elements from list src to list target. If deleteFromSource is non-zero, all elements are removed from source list. (but not deleted)
Name | Type | Default | Description |
Return | int | 0 oder Fehlercode. | |
target | WorkflowStatusList - | target list | |
src | WorkflowStatusList - | source list | |
deleteFromSource | 0 | delete elements from source |
static WorkflowStatus workflowstatus::alloc()
Create a new, empty WorkflowStatus object.
Name | Type | Default | Description |
Return | WorkflowStatus | object of type WorkflowStatus. This object must be released using publication::workflowstatus::release. |
static int workflowstatus::release(WorkflowStatus status)
Release a WorkflowStatus object
Name | Type | Default | Description |
status | - | WorkflowStatus | object to release |
static char* workflowstatus::gets(WorkflowStatus status, int selector)
Get a String property of a WorkflowStatus object.
Name | Type | Default | Description |
Return | char * | (String) property of this object determined by selector | |
workflowstatus | - | WorkflowStatusList | WorkflowStatusList object |
selector | int | - | which property? Valid values are kStringID kID (Alias for kStringID) kName kLabel (Alias for kName) kType kActionId kActionId is only available for document specific Workflow states |
static char* workflowstatus::to_xml(WorkflowStatus workflowstatus, char* rootElementName = "workflowstatus")
Generate a XML structure of a WorkflowStatus object.
If you think about using this function, you might be interested in further information about cscript / java interaction. Related information can be found here.
Name | Type | Default | Description |
Return | char * | xml string or 0 on errors. The result string is valid until the next time a to_xml function is called and must not be changed or released. | |
workflowstatus | WorkflowStatus | - | object |
rootElementName | String or char* | workflowstatus | name of the root element |
static WorkflowStatus workflowstatus::from_xml(char* xml)
Create a WorkflowStatus object from a xml structure.
If you think about using this function, you might be interested in further information about cscript / java interaction. Related information can be found here.
Name | Type | Default | Description |
Return | WorkflowStatus | object of type WorkflowStatus. This object must be released using workflowstatus::release. | |
xml | String or char* | - | xml structure |
static int workflowstatus::copy(WorkflowStatus destination, WorkflowStatus source)
Copy all values from object source to object destination.
Name | Type | Default | Description |
Return | int | 0 or ErrorCode | |
destination | WorkflowStatus | - | destination object |
destination | WorkflowStatus | - | source object |
static int planninglist::release(PlanningList list)
Release a PlanningList.
Name | Type | Default | Description |
list | PlanningList | - | list to release |
static int planninglist::length(PlanningList list)
Get the length of a planning list
Name | Type | Default | Description |
Return | int | list length | |
list | PlanningList | - | list |
static Planning planninglist::get(PlanningList list, int index)
Get the nth Planning from this PlanningList. Index must be within { 0 .. list length - 1 }.
Name | Type | Default | Description |
Return | Planning | Planning object | |
list | - | PlanningList | list |
n | int | - | index of list element |
static char* planninglist::to_xml(PlanningList list, char* rootElementName = "plannings")
Generate a XML structure of a PlanningList object.
If you think about using this function, you might be interested in further information about cscript / java interaction. Related information can be found here.
Name | Type | Default | Description |
Return | char * | xml string or 0 on errors. The result string is valid until the next time a to_xml function is called and must not be changed or released. | |
list | PlanningList | - | list object |
rootElementName | String or char* | plannings | name of the root element |
static PlanningList planninglist::from_xml(char* xml)
Create a PlanningList object from a xml structure.
If you think about using this function, you might be interested in further information about cscript / java interaction. Related information can be found here.
Name | Type | Default | Description |
Return | PlanningList | list of type PlanningList. This list must be released using planninglist::release. | |
xml | String or char* | - | xml structure |
static PlanningList planninglist::alloc()
Create a new, empty PlanningList object.
Name | Type | Default | Description |
Return | PlanningList | object of type PlanningList. This object must be released using publication::planninglist::release. |
static int planninglist::add_all(
PlanningList target,
PlanningList src,
int deleteFromSource)
Append all elements from list src to list target. If deleteFromSource is non-zero, all elements are removed from source list. (but not deleted)
Name | Type | Default | Description |
Return | int | 0 oder Fehlercode. | |
target | PlanningList - | target list | |
src | PlanningList - | source list | |
deleteFromSource | 0 | delete elements from source |
static int planning::release(Planning planning)
Release a Planning object
Name | Type | Default | Description |
planning | - | Planning | object to release |
static int planning::get(Planning planning, int selector)
Get an Integer property of a Planning object.
Name | Type | Default | Description |
Return | int | (Integer) property of this object determined by selector | |
planning | Planning | - | Planning object |
selector | int | - | Which property? Valid values are kDeleted kID kImportId kPageTemplateElementId kPageTemplateId kPrintTemplateId kSequence kUsePrintPageTemplate |
static char* planning::gets(Planning planning, int selector)
Get a String property of a Planning object.
Name | Type | Default | Description |
Return | char * | (String) property of this object determined by selector | |
planning | Planning | - | Planning object |
selector | int | - | which property? Valid values are kBucketId kContextAssortment kContextCountry kContextLanguage kContextWell kContextMarket kContextTargetGroup kContextPublication kContextDocumentId kCreatedBy kCreatedOn kDpTemplateId kEntityBucketId kEntityModelId kEntityPlanningId kIdentifier kLabel kOrigin kPageId kParentPlanningId kTimestamp kUpdatedBy kUpdatedOn kVersion |
static float planning::getfloat(Planning planning, int selector)
Get a Float property of a Planning object.
Name | Type | Default | Description |
Return | float | (Float) property of this object determined by selector | |
planning | - | Planning | Planning object |
selector | int | - | which property? Valid values are kXPosBottomRight kXPosTopLeft kYPosBottomRight kYPosTopLeft |
static StringList planning::getlist(Planning planning, int selector)
Get a list property of a Planning object.
Name | Type | Default | Description |
Return | StringList | (list of strings) property of this object determined by selector | |
planning | - | Planning | Planning object |
selector | int | - | which property? Valid values are kPriceRefs kTableDataRefs kTextRefs kBucketRefs kCordRefs kKeyValueRefs kChildren kMediaAssetRefs kMetaData |
static char* planning::to_xml(Planning planning, char* rootElementName = "planning")
Generate a XML structure of a Planning object.
If you think about using this function, you might be interested in further information about cscript / java interaction. Related information can be found here.
Name | Type | Default | Description |
Return | char * | xml string or 0 on errors. The result string is valid until the next time a to_xml function is called and must not be changed or released. | |
planning | Planning- | object | |
rootElementName | String or char* | planning | name of the root element |
static Planning planning::from_xml(char* xml)
Create a Planning object from a xml structure.
If you think about using this function, you might be interested in further information about cscript / java interaction. Related information can be found here.
Name | Type | Default | Description |
Return | Planning | object of type Planning. This object must be released using planning::release. | |
xml | String oder char* | - | xml structure |
static Planning planning::alloc()
Create a new, empty Planning object.
Name | Type | Default | Description |
Return | Planning | object of type Planning. This object must be released using publication::planning::release. |
static int planning::copy(Planning destination, Planning source)
Copy all values from object source to object destination.
Get publication and root publication ID of a publication or document
// Root/Publication-ID
/** * Demonstrates how to get the publication ID and * root publication ID for a document. * * See also DocumentProperties example * * This script DOES require an opened publication document. */ int main() { char * buffer = alloc (4096);
// use the // publication::get_publication_id // function to get the publication ID for a document: strcpy (buffer, publication::get_publication_id()); wlog ("", "Publication ID='%s'\n", buffer);
// // variants: // 1. use the current front document: // publication::get_publication_id () // 2. specify the document ID: // publication::get_publication_id (char * documentId) // // Example: // char * documentId = alloc (4096); // char * publicationId = alloc (4096); // xml::get_document_attribute (gDocument, "documentId", documentId); // strcpy (publicationId, publication::get_publication_id (documentId)); //
// use the // publication::get_rootpublication_id // function to get the publication ID for a document: strcpy (buffer, publication::get_rootpublication_id()); wlog ("", "Root Publication ID='%s'\n", buffer);
// // variants: // 1. use the current front document: // publication::get_rootpublication_id () // 2. specify the document ID: // publication::get_rootpublication_id (char * documentId) // // Example: // char * documentId = alloc (4096); // xml::get_document_attribute (gDocument, "documentId", documentId); // strcpy (publicationId, publication::get_rootpublication_id (documentId)); //
release (buffer);
return 0; }
Read and write properties of publications or documents
// Publication proporties
/** * Demonstrates how to * - retrieve document properties from PubServer for a * specific document * - change / write particular properties to the server * * See also the DocumentInformation example * * This script DOES require an opened publication document. * * CAUTION! * This script changes description and label of the current * document! */ int main() { char * buffer = alloc (4096);
// for demo purpose, we copy the documentId into a // variable. // The documentId parameter can also be 0, in this // case the ID of the current front document is used. char * documentId = alloc (4096);
strcpy (documentId, publication::get_parameter_from_document (gDocument, "documentId")); // use the // publication::get_property // function to retrieve document properties // strcpy (buffer, publication::get_property (documentId, "description")); wlog ("", "Document description='%s'\n", buffer);
strcpy (buffer, publication::get_property (documentId, "label2")); wlog ("", "Document label2='%s'\n", buffer);
// for label2 there is also a shortcut, the following should // give the same result: strcpy (buffer, publication::get_label (documentId)); wlog ("", "Document label2 (again)='%s'\n", buffer);
// NOTE: // At the time cscript / InDesign® plugins support arbitrary // property names, but only some are supported in PubServer. // // Property names known to work are: // description, masterdocument, sort, label, label2 ... // // If more properties are required, this must be implemented // in the PubServer (CometDataBean).
// to set properties, use the // publication::set_property // or // publication::set_label // functions: publication::set_property (documentId, "description", "Description (changed from cscript)"); publication::set_label (documentId, "Label (changed from cscript)");
release (buffer); release (documentId); return 0; }
List of all available parameters
// Parameter
#include "internal/publications.h"
/** * Get all available publication parameters. */ int main () { // use the // publication::get_all_parameters // function to get ALL available parameters including // meta information (such as type, identifier, label etc.) // // The function returns a newly allocated ParameterList object, // which should (or actually must) be released later. // ParameterList parameters = publication::get_all_parameters (); Parameter parameter = 0; ParameterList dropdownValues = 0; Parameter dropdownEntry = 0; int c = 0; char * paramIdentifier = alloc (4096); char * paramLabel = alloc (4096); char * paramValue1 = alloc (4096); char * paramValue2 = alloc (4096); char * paramValue3 = alloc (4096); int paramType = 0; int paramId = 0;
// use the // publication::parameterlist::length // and // publication::parameterlist::get // functions to iterate through list for (c = 0; c < publication::parameterlist::length (parameters); ++c) { parameter = publication::parameterlist::get (parameters, c);
// use the // publication::parameter::gets (for string values) // and // publication::parameter::get (for integer values) // functions to access parameter properties. // // Valid property selectors are: // kID (Integer) : the parameter ID // kType (Integer) : the parameter type, one of // kTypeText // kTypeCombo or // kTypeCheckbox // kIdentifier (String): identifier of the parameter // kLabel (String) : human readable parameter name // kValue1 (String) : first value // kValue2 (String) : second value // kValue3 (String) : third value // //
strcpy (paramIdentifier, publication::parameter::gets (parameter, kIdentifier)); strcpy (paramLabel, publication::parameter::gets (parameter, kLabel)); strcpy (paramValue1, publication::parameter::gets (parameter, kValue1)); strcpy (paramValue2, publication::parameter::gets (parameter, kValue2)); strcpy (paramValue3, publication::parameter::gets (parameter, kValue3));
paramType = publication::parameter::get (parameter, kType); paramId = publication::parameter::get (parameter, kID);
wlog ("", "Parameter: %s [%s | %d], type=%d, values='%s'|'%s'|'%s'\n", paramLabel, paramIdentifier, paramId, paramType, paramValue1, paramValue2, paramValue3); // CAUTION! Do NOT try the following: // wlog ("", "Parameter: %s=%s\n", // publication::parameter::gets (workflowStatus, kLabel), // publication::parameter::gets (workflowStatus, kValue1) ); // // The result pointer of the gets function refers to a static string and each
// usage of this function will dispose pointers from previous results. // In some situation this might even work (if the memory isn't reallocated in // the meantime), but it can also cause access violations and crashes.
// read dropdown values for combo parameter type if (paramType == kTypeCombo) { // use the // publication::get_parameter_values // function to get a list (again a ParameterList) of available DropDown // values for a specific parameter. // // Note: // - this function only works for COMBO (kTypeCombo) parameters // - you must provide the parameter ID (NOT the identifier) // dropdownValues = publication::get_parameter_values (paramId); // ... etc. wlog ("", "DropDown has %d entries\n", publication::parameterlist::length (dropdownValues));
// don't forget to release publication::parameterlist::release (dropdownValues); }
return 0; }
publication::parameterlist::release (parameters);
release (paramIdentifier); release (paramLabel); release (paramValue1); release (paramValue2); release (paramValue3);
return 0; }
Parameters of a publication or a document
// Parameters of Publikation
/** * Demonstrates how to * - retrieve publication parameters from PubServer * for a specific document * - transfer publication parameters into the XML structure * of the document * * See also the Parameters and SetParameters examples * * This script DOES require an opened publication document. */ int main() { // use the // publication::get_parameters // function to retrieve parameters (key value pairs) for // the current front document: StringList documentParameters = publication::get_parameters(); char * key = alloc (4096); char * value = alloc (4096); int i = 0, c = 1; int resultCode = 0;
// // variants: // 1. use the current front document: // publication::get_parameters () // 2. specify the document ID: // publication::get_parameters (char * documentId) // // Example: // char * documentId = alloc (4096); // xml::get_document_attribute (gDocument, "documentId", documentId); // documentParameters = publication::get_parameters (documentId); //
// iterate through stringlist for (i = 0; i < stringlist::length (documentParameters) - 1; i += 2) { strcpy (key, stringlist::get (documentParameters, i)); strcpy (value, stringlist::get (documentParameters, i + 1));
wlog ("", "Parameter %d: %s='%s'\n", i, key, value);
// NOTE: // Multi value parameters are listed in this format: // key => value1:value2:value3 // key_1 => value1 // key_2 => value2 // key_3 => value3 // // Checkbox (boolean) values will be either "true" or "false" // // The value of ComboBox parameters is the identifier of the // selected list entry }
// use the // publication::apply_parameters // function to transfer all parameters into the document // XML structure: resultCode = publication::apply_parameters (gDocument);
wlog ("", "publication::apply_parameters returned code %d\n", resultCode);
// You can use publication::get_parameter_from_document to read a // parameter value from the document XML structure. // Actually, this is just a shorthand for // xml::get_document_attribute (ItemRef doc, char * parameterIdentifier, char * out) // The result pointer is valid until the next call of the function. // wlog ("", "Parameter (in this case: documentId) read from document: %s\n", publication::get_parameter_from_document (gDocument, "documentId"));
release (key); release (value); stringlist::release (documentParameters); return 0; }
Write parameters of a publication or a document
// Write Parameters
/** * Demonstrates how to set (i.e.: write to PubServer) * parameters. * * See also the DocumentParameters and Parameters examples * * This script DOES require an opened publication document. * * NOTE: * This only works, if you configured the following parameters * for the test document (identifier: type): * * - text: text parameter with 3 values * - combo: ComboBox parameter with a list entry named 'test' * - check: Checkbox parameter */ int main() { char * parameterIdentifier = alloc (4096); int resultCode = 0; // we copy the documentId into a variable. We could also use '0' for // the following examples, in this case the documentId is read from // the current front document. char * documentId = alloc (4096);
strcpy (documentId, publication::get_parameter_from_document (0, "documentId"));
// use the // publication::set_parameter // function to write a parameter value back to PubServer
// 1. Text parameter. // You can specify 1 .. 3 parameter values strcpy (parameterIdentifier, "text"); resultCode = publication::set_parameter (documentId, parameterIdentifier, "first value", "second value", "third value"); wlog ("", "Set %s parameter returned result code %d\n", parameterIdentifier, resultCode);
// 2. ComboBox strcpy (parameterIdentifier, "combo"); resultCode = publication::set_parameter (documentId, parameterIdentifier, "test"); wlog ("", "Set %s parameter returned result code %d\n", parameterIdentifier, resultCode);
// 3. Checkbox // Use "false", "0" or "null" to set the value to false (unchecked), // all other values will be interpreted as true. strcpy (parameterIdentifier, "check"); resultCode = publication::set_parameter (documentId, parameterIdentifier, "true"); wlog ("", "Set %s parameter returned result code %d\n", parameterIdentifier, resultCode);
return 0; }
Lst all publication types
// Publikation Types
#include "internal/publications.h" /** * Rather unspectacularly: get all publication types from server * * This script does NOT require a opened publication * document. */ int main() { // use the // // publication::get_publication_types // // function to get a list of all configured publication types // PublicationTypeList publicationTypeList = publication::get_publication_types(); PublicationType publicationType = 0; int c = 0; char * id = alloc (4096); char * label = alloc (4096);
// use the // publication::publicationtypelist::length // and // publication::publicationtypelist::get // functions to iterate through list for (c = 0; c < publication::publicationtypelist::length (publicationTypeList); ++c) { publicationType = publication::publicationtypelist::get (publicationTypeList, c);
// use the // publication::publicationtype::gets (for string values) // function to access publication type properties. // // Valid property selectors are // // kID (String) : the workflow status ID // kLabel (String) : human readable workflow status name strcpy (id, publication::publicationtype::gets (publicationType, kID)); strcpy (label, publication::publicationtype::gets (publicationType, kLabel));
wlog ("", "PublicationType: %s [ %s ]\n", label, id);
// CAUTION! Do NOT try the following: // wlog ("", "PublicationType: %s [ %s ]\n", // publication::publicationtype::gets (publicationType, kLabel), // publication::publicationtype::gets (publicationType, kID) ); // // The result pointer of the gets function refers to a static string and each // usage of this function will dispose pointers from previous results. // In some situation this might even work (if the memory isn't reallocated in // the meantime), but it can also cause access violations and crashes. }
release (id); release (label);
publication::publicationtypelist::release (publicationTypeList);
return 0; }
Workflow States
// Workflow States
#include "internal/publications.h"
/** * Demonstrates how to retrieve all available document workflow * states from the PubServer and how to get properties of * particular workflow states. * * See also the DocumentWorkflow example script. * * This script does NOT require a opened publication * document. */ int main() { // use the // // publication::get_workflow_states // // function to get a list of all available workflow states // WorkflowStatusList workflowStatusList = publication::get_workflow_states (); WorkflowStatus workflowStatus = 0; int c = 0; char * id = alloc (4096); char * label = alloc (4096); char * type = alloc (4096); char * actionId = alloc (4096);
// use the // publication::workflowstatuslist::length // and // publication::workflowstatuslist::get // functions to iterate through list for (c = 0; c < publication::workflowstatuslist::length (workflowStatusList); ++c) { workflowStatus = publication::workflowstatuslist::get (workflowStatusList, c);
// use the // publication::workflowstatus::gets (for string values) // function to access workflow status properties. // // Valid property selectors are // // kID (String) : the workflow status ID // kType (String) : the workflow status type // kLabel (String) : human readable workflow status name // kActionId (String) : ID of the action associated to this status / object. // actionId is always empty for "global" workflow states, // and only set, when the workflow status has been // requested for a specific document in a specific // workflow state (i.e.: using either the // publication::get_document_workflow_status // or // publication::get_next_workflow_steps // function. // See also the DocumentWorkflow example). strcpy (id, publication::workflowstatus::gets (workflowStatus, kID)); strcpy (label, publication::workflowstatus::gets (workflowStatus, kLabel)); strcpy (type, publication::workflowstatus::gets (workflowStatus, kType)); strcpy (actionId, publication::workflowstatus::gets (workflowStatus, kActionId));
wlog ("", "WorkflowStatus: %s [ %s ], type=%s, actionId=%s\n", label, id, type, actionId);
// CAUTION! Do NOT try the following: // wlog ("", "WorkflowStatus: %s [ %s ]\n", // publication::workflowstatus::gets (workflowStatus, kLabel), // publication::workflowstatus::gets (workflowStatus, kID) ); // // The result pointer of the gets function refers to a static string and each // usage of this function will dispose pointers from previous results. // In some situation this might even work (if the memory isn't reallocated in // the meantime), but it can also cause access violations and crashes. }
release (id); release (label); release (type); release (actionId);
publication::workflowstatuslist::release (workflowStatusList);
return 0; }
Workflow State of document
// Document Workflow State
#include "internal/publications.h"
/** * Demonstrates how to retrieve all available workflow states * from the PubServer for a specific (e.g. the current front) * document. * * See also the Workflow and DocumentNextSteps example script. * * This script DOES require a opened publication document. * * NOTE 1: at the time you get the list in alphabetical order. * This is subject to change without notice. * NOTE 2: if no workflow process is assigned to this document, * the result list is just empty (not null) * */ int main() { // use the // // publication::get_document_workflow_states // // function to get a list of workflow states available for the // current document. // WorkflowStatusList workflowStatusList = publication::get_document_workflow_states (); // // variants: // 1. use the current front document: // publication::get_document_workflow_states () // 2. specify the document ID: // publication::get_document_workflow_states (char * documentId) // // Example: // char * documentId = alloc (4096); // xml::get_document_attribute (gDocument, "documentId", documentId); // workflowStatusList = publication::get_document_workflow_states (documentId); WorkflowStatus workflowStatus = 0; int c = 0; char * id = alloc (4096); char * label = alloc (4096); char * type = alloc (4096); char * actionId = alloc (4096);
// use the // publication::workflowstatuslist::length // and // publication::workflowstatuslist::get // functions to iterate through list for (c = 0; c < publication::workflowstatuslist::length (workflowStatusList); ++c) { workflowStatus = publication::workflowstatuslist::get (workflowStatusList, c);
// use the // publication::workflowstatus::gets (for string values) // function to access workflow status properties. // // Valid property selectors are // // kID (String) : the workflow status ID // kType (String) : the workflow status type // kLabel (String) : human readable workflow status name // kActionId (String) : ID of the action associated to this status / object. // actionId is always empty for "global" workflow states, // and only set, when the workflow status has been // requested for a specific document in a specific // workflow state (i.e.: using either the // publication::get_document_workflow_status // or // publication::get_next_workflow_steps // function. // See also the DocumentWorkflow example). strcpy (id, publication::workflowstatus::gets (workflowStatus, kID)); strcpy (label, publication::workflowstatus::gets (workflowStatus, kLabel)); strcpy (type, publication::workflowstatus::gets (workflowStatus, kType)); strcpy (actionId, publication::workflowstatus::gets (workflowStatus, kActionId));
wlog ("", "WorkflowStatus: %s [ %s ], type=%s, actionId=%s\n", label, id, type, actionId);
// CAUTION! Do NOT try the following: // wlog ("", "WorkflowStatus: %s [ %s ]\n", // publication::workflowstatus::gets (workflowStatus, kLabel), // publication::workflowstatus::gets (workflowStatus, kID) ); // // The result pointer of the gets function refers to a static string and each // usage of this function will dispose pointers from previous results. // In some situation this might even work (if the memory isn't reallocated in // the meantime), but it can also cause access violations and crashes. }
release (id); release (label); release (type); release (actionId);
publication::workflowstatuslist::release (workflowStatusList);
return 0; }
Set Workflow Status
// Set Workflow Status
#include "internal/publications.h"
/** * Demonstrates how to * - retrieve the NEXT available workflow states from the * PubServer for a specific (e.g. the current front) document. * - set a workflow state (i.e. set the actionId) for a document * * See also the Workflow and DocumentWorkflow example script. * * This script DOES require a opened publication document. * */ int main() { // use the // // publication::get_document_workflow_states // // function to get a list of next workflow states available // for the current document. // WorkflowStatusList workflowStatusList = publication::get_next_workflow_states (); // // variants: // 1. use the current front document: // publication::get_next_workflow_states () // 2. specify the document ID: // publication::get_next_workflow_states (char * documentId) // // Example: // char * documentId = alloc (4096); // xml::get_document_attribute (gDocument, "documentId", documentId); // workflowStatusList = publication::get_next_workflow_states (documentId);
WorkflowStatus workflowStatus = 0; int c = 0; char * id = alloc (4096); char * label = alloc (4096); char * qtype = alloc (4096); char * actionId = alloc (4096); char * nextActionId = alloc (4096); int resultCode = 0;
// use the // publication::workflowstatuslist::length // and // publication::workflowstatuslist::get // functions to iterate through list for (c = 0; c < publication::workflowstatuslist::length (workflowStatusList); ++c) { workflowStatus = publication::workflowstatuslist::get (workflowStatusList, c);
// use the // publication::workflowstatus::gets (for string values) // function to access workflow status properties. // // Valid property selectors are // // kID (String) : the workflow status ID // kType (String) : the workflow status type // kLabel (String) : human readable workflow status name // kActionId (String) : ID of the action associated to this status / object. // actionId is always empty for "global" workflow states, // and only set, when the workflow status has been // requested for a specific document in a specific // workflow state (i.e.: using either the // publication::get_document_workflow_status // or // publication::get_next_workflow_steps // function. // See also the DocumentWorkflow example). strcpy (id, publication::workflowstatus::gets (workflowStatus, kID)); strcpy (label, publication::workflowstatus::gets (workflowStatus, kLabel)); strcpy (type, publication::workflowstatus::gets (workflowStatus, kType)); strcpy (actionId, publication::workflowstatus::gets (workflowStatus, kActionId));
wlog ("", "WorkflowStatus: %s [ %s ], type=%s, actionId=%s\n", label, id, type, actionId);
// if nextActionId has not yet been set, copy actionId to nextActionId if (strlen (nextActionId) == 0) { strcpy (nextActionId, actionId); }
// CAUTION! Do NOT try the following: // wlog ("", "WorkflowStatus: %s [ %s ]\n", // publication::workflowstatus::gets (workflowStatus, kLabel), // publication::workflowstatus::gets (workflowStatus, kID) ); // // The result pointer of the gets function refers to a static string and each // usage of this function will dispose pointers from previous results. // In some situation this might even work (if the memory isn't reallocated in // the meantime), but it can also cause access violations and crashes. }
// if nextActionId is not empty: set workflow state to this action if (strlen (nextActionId) > 0) { // - first parameter is documentId (or 0 to use the documentId of the // current front document) // - second parameter is action ID (NOT workflowstatus ID) // - third parameter is a "url" - whatever this is good for resultCode = publication::set_document_workflow_status (0, nextActionId, ""); wlog ("", "publication::set_document_workflow_status returned code %d\n", resultCode); }
release (id); release (label); release (type); release (actionId); release (nextActionId);
publication::workflowstatuslist::release (workflowStatusList); return resultCode; }
Search Documents
// Search Documents
#include "internal/publications.h" int debugPublicationList (PublicationList publications) { Publication publication = 0; int c = 0;
for (; c < publication::publicationlist::length(publications); ++c) { publication = publication::publicationlist::get (publications, c);
wlog ("", "Document #%d [%d]\n", (c + 1), publication); wlog ("", "\tID=%s\n", publication::gets (publication, kStringID)); wlog ("", "\tLabel=%s\n", publication::gets (publication, kName)); wlog ("", "\tPath=%s\n", publication::gets (publication, kPath)); }
return 0; }
int main() { PublicationList searchResult = 0; Publication publication = 0; int c = 0;
// // the search function takes 20 parameters, // all can be 0, empty strings or omitted. // char * rootPublicationId = ""; char * subPublicationId = ""; char * docName = ""; char * workflowStatusId1 = ""; char * workflowStatusId2 = ""; char * workflowStatusId3 = ""; char * param1 = ""; char * value11 = ""; char * value12 = ""; char * value13 = ""; char * param2 = ""; char * value21 = ""; char * value22 = ""; char * value23 = ""; char * param3 = ""; char * value31 = ""; char * value32 = ""; char * value33 = ""; int restrictiveCheckbox = 1; int recursive = 1;
// // this will just get ALL documents: searchResult = publication::search(); wlog ("", "Found %d documents\n", publication::publicationlist::length (searchResult)); debugPublicationList (searchResult); publication::publicationlist::release (searchResult);
// // find all publications with a particular name (in this case // documents like 0010, 0100, 0110, ...) // searchResult = publication::search (0, 0, "10"); wlog ("", "Found %d documents\n", publication::publicationlist::length (searchResult)); debugPublicationList (searchResult); publication::publicationlist::release (searchResult);
return 0; }
Publication Tree
// Publication Tree
#include "internal/publications.h" int debugPublicationList (PublicationList publications) { Publication publication = 0; int c = 0;
for (; c < publication::publicationlist::length(publications); ++c) { publication = publication::publicationlist::get (publications, c);
wlog ("", "Document #%d [%d]\n", (c + 1), publication); wlog ("", "\tID=%s\n", publication::gets (publication, kStringID)); wlog ("", "\tLabel=%s\n", publication::gets (publication, kName)); wlog ("", "\tPath=%s\n", publication::gets (publication, kPath)); }
return 0; } int getSubPublications (char * publicationId) { PublicationList tree = 0; Publication publication = 0; int c = 0; char * subPublicationId = alloc (4096);
wlog ("", "\n\n=> Children of publication '%s'\n\n", publicationId);
// use the // publication::get_tree // function to load the publications. // No parameter, 0 or empty string means: get root publication. // tree = publication::get_tree(publicationId);
debugPublicationList (tree);
for (c = 0; c < publication::publicationlist::length (tree); ++c) { publication = publication::publicationlist::get (tree, c);
strcpy (subPublicationId, publication::gets (publication, kStringID));
if (publication::get (publication, kHasChildren) == 1) { getSubPublications (subPublicationId); } }
release (subPublicationId); publication::publicationlist::release (tree);
return 0; }
int main() { return getSubPublications (""); }
PDF export of all documents of all selected publications. The documents should be exported to a common PDF and in the same order as in the panel.
#include "internal/panels.h" #include "internal/products.h"
char stBookPath [] = "$DESKTOP/";
// recursively collect publications of type document int add_publica ( IDTypeList ids, StringList names, IDType id, char * path, char * name) { PublicationList children = 0; Publication p; int i; IDType cid;
if (string::length (path) > 2) { // Only documents having a path
idtypelist::append (ids, id); //register the object stringlist::append (names, name); //register the name
wlog ("", "# pub %d : '%s' with id [%d %d %d '%s']\n", idtypelist::length (ids), name, idtype::id (id), idtype::id2 (id), idtype::id3 (id), idtype::stringid (id)); } else { // Recursively dive into the publication children = publication::get_tree (idtype::stringid (id)); for (i = 0; i < publication::publicationlist::length (children); i++) { p = publication::publicationlist::get (children, i); cid = idtype::alloc ( publication::get (p, kID), publication::get (p, kID2), publication::get (p, kID3), publication::gets (p, kStringID)); add_publica ( ids, names, cid, publication::gets (p, kPath), publication::gets (p, kName)); idtype::release (cid); } publication::publicationlist::release (children); }
return 0; }
int main () { IDTypeList pub_sel = idtypelist::alloc (kPanelPublications, kSelected); // Currently selected entries of publications panel List pub_li = list::alloc (kPanelPublications, kSelected); // Need this for name and path of the currently selected entries only IDTypeList pub_ids = idtypelist::alloc (); // All documents of the selected publications (recursive dive into *pub_sel*) int i = 0; IDType id; String name = string::alloc (); // Name of selected publiction(s) String path = string::alloc (); // Path of selected publiction(s) StringList names = stringlist::alloc (); // List of names - needed for messages only String msg = string::alloc (); // Progress bar messages String bookPath = string::alloc (stBookPath); // Path of temporay InDesign® book String pdfPath = string::alloc (stBookPath); ItemRef bookRef = item::alloc ();
wlog ("", "\n# Export selected publications to PDF\n");
// Collect IDs for (id = idtypelist::first (pub_sel); id; id = idtypelist::next (pub_sel)) { // get name and path of the selected entries directly fro the panel list::gettext (pub_li, i, "Path", path); list::gettext (pub_li, i, "State", name); // ATTENTION : Name is shown in field state1! string::trim (path, '\''); string::trim (name, '\''); i++;
// Use the first name as to be the output name if (i == 1) { string::append (bookPath, name); string::append (bookPath, ".indb"); string::append (pdfPath, name); string::append (pdfPath, ".pdf"); }
// Recursive dive into the entry add_publica (pub_ids, names, id, string::get (path), string::get (name)); }
// If no documents selected, return immediately if (idtypelist::length (pub_ids) == 0) { wlog ("", "# No publication documents selected\n"); wlog ("", "# Export selected publications to PDF - done\n"); return 0; }
// Create the book string::set (msg, "Export publications to '%s'", file::name (name, pdfPath)); progress::start (msg, idtypelist::length (pub_ids)*3+2); file::remove (bookPath); book::create (bookPath); book::open (bookPath, bookRef);
// Check out documents and insert them into the book i = 0; for (id = idtypelist::first (pub_ids); id; id = idtypelist::next (pub_ids)) { string::set (msg, "Checkout %d/%d : '%s'", i+1, idtypelist::length (pub_ids), stringlist::get (names, i)); progress::step(msg, 2); wlog ("", "# %s\n", msg); i++;
publication::checkout_by_id ( // Check out. This will open the document as the new front document idtype::stringid (id), idtype::id (id), idtype::id2 (id), idtype::id3 (id));
document::path (path, 0); // Get the path of the current front document book::insert (bookRef, path); // Append the document to the book }
// Export the book progress::step("Exporting PDF", 1); wlog ("", "# %s\n", "Exporting PDF"); book::repaginate (bookRef); book::export_ (bookRef);
// Close book and remove its file book::close (bookRef); file::remove (bookPath);
// Revert checked out documents i = 0; for (id = idtypelist::first (pub_ids); id; id = idtypelist::next (pub_ids)) { string::set (msg, "Revert %d/%d : '%s'", i+1, idtypelist::length (pub_ids), stringlist::get (names, i)); progress::step(msg, 1); wlog ("", "# %s\n", msg); i++;
publication::revert_by_id ( idtype::stringid (id), idtype::id (id), idtype::id2 (id), idtype::id3 (id)); }
// Finish work progress::stop(bookPath); file::launch (pdfPath); wlog ("", "# Export selected publications to PDF - done\n\n");
return 0; }
Alphabetic index HTML hierarchy of classes or Java