comet.product

The comet.product module provides access to product functionality

See also

CProduct

Methods

comet.product.create()

Create a new empty CProduct object.

Returns:

The new product

Return type:

CProduct

Available:

InDesign® comet_pdf®

comet.product.get(statement)

Fetch the list of products from the product pool panel. The input statement determines which product entries to get.

Parameters:

statement (str) – Instructions on which entries to get. See here

Returns:

The products matching the query statement

Return type:

list[CProduct]

Available:

InDesign® comet_pdf® Illustrator®

CScript:

productlist::get

comet.product.establish(products, pageTemplateID, templateID, page=None, layer=None, flags=0, preScriptID=0, ignoreLayers=[])

Establish products using page templates.

Here you will find a short tutorial on product establishing using page templates.

Parameters:
  • products (list[CProduct]) – The products to establish

  • pageTemplateID (int) –

    Initial page template to use for building.

    Page breaks are achieved by inserting products with kProductType = 4 (page template) into the product list.

    Here you will find an example (CScript).

  • templateID (int) –

    Template to use for building product(s).

    See kPreferDefaultPageItem for more information

  • page (None | int | CPage) –

    The page to start establishing the products on.

    • None: The current page of the current script document

    • int: Page index of the current script document

    • CPage: A target page

    InDesign® comet_pdf® Using InDesign® Server or comet_pdf the current front page is undefined!

  • layer (None | str | CLayer) –

    The layer to build the products on.

    • None: Current front layer

    When the layer type is str, this is the name of the desired layer.

    When the layer type is CLayer, it must belong to the same document as the parameter page.

  • flags (int) –

    Build flags to customize the build process.

    • constants.kPreferDefaultPageItem : Use pageItem for all products. Otherwise pageItem is used only for products with no pageitem given.

    • constants.kSkipEmptyTemplates : Skip products with no template defined.

    • constants.kShowProgress : Show progress bar

    • constants.kCheckIfNotExists : Check whether a product already exists in the document and suppress inserting if so.

    • constants.kAutoDetectType : While inserting templates as text we have two possibilities : Insert a frame as inline or insert the frames (text) content. With kAutoDetectType set, the following is done : Insert the text content if the frame is a text frame and inserted the frame as an inline otherwise.

    • constants.kSuppressAlerts Suppress alerts while building products. Some alerts like ‘Object will leave the paste board’ are too deep inside InDesign® and cannot suppressed!

    • constants.kIgnoreErrors : Ignore errors and continue. This may generate gaps in page elements. Reorganizing the document again will fill this gaps.

    • constants.kPreferExistingPages : If document pages are already linked against page templates, prefer this page templates instead of the the page template given in pageTemplate. If the last page is reached, the normal page templates successor rules are used.

    • constants.kPreferProductPTProducts may contain a page template. Product page templates are shown (delimited by an @) behind the products template in the product pool. The page template is given by the panelstatements in the column gridID.

      Every page template will create a page break. Products without a page template will use the standard page template as given above. ATTENTION : This version of Comet does NOT support page breaks to specific page type (left, right pages)!

    • constants.kLoadMasterItems: Override and link all master page frames linked with place holders after successfully building all products. In this case, we walk through all pages of the document. The document will remember, whether the flag is set or not : If the flag is set, all subsequent reorganizations will walk through the master pages items too.

  • preScriptID (int) –

    ID of the preparation script.

    The script is executed in that the list of the products to be imported is determined and can then be used to process the product list.

    For more see product::set, product::clone, productlist and on chapter Script support.

    • 0: Don’t execute a prescript

  • ignoreLayers (list[str | CLayer]) –

    List of layers to ignore.

    Newly inserted products may overlay frames of these layers.

    The entries of this list may be of the following types:

    • CLayer: A document layer. Must belong to the same document as the target layer or page

    • str: A layer name. There are some special keywords which may be provided instead of an actual name:

      • ’invisibles’ : All invisible layers

      • ’except name’ : All except layer name

      • ’behind name’ : All behind layer name

      • ’background’ : The bottommost layer

Return type:

None

Available:

InDesign® comet_pdf®

CScript:

productlist::establish

comet.product.getEstablished(start=None)

Ascertain the products built in a document and the page templates used for building these products.

Parameters:

start (None | int | CDocument | tuple[CDocument, int] | CPage | CPageItem) –

Where to start searching for built products.

The parameter type can be:

  • None

    Use the current active script document at start page index 0

  • int

    Use the current active script document with this value as the start page index

  • CDocument

    Use this document at start page index 0

  • tuple [CDocument, int]

    Use this document and the provided int as the start page index

  • CPage

    Use this page as the start page

  • CPageItem

    Start search at this item

Returns:

The found products and page templates

Return type:

list[CProduct]

Raises:
Available:

InDesign® comet_pdf®

CScript:

productlist::get_established

comet.product.setBuildTrace(enable=1, showNails=-2, showUIDs=-2, showEdges=-2, resolution=0.0)

(De)activate build tracing.

Build tracing is deactivated after InDesign® restarts automatically!

Build tracing may significantly slow down the product building process. Images are created in the folder $CACHE/BuildTrace. Don’t forget to clear this folder from time to time.

Parameters:
  • enable (int) –

    Activate build tracing?

    • -2: Leave untouched

    • -1: Toggle

    • 0: Off

    • 1: On

  • showNails (int) –

    Show nails and magnets?

    • -2: Leave untouched

    • -1: Toggle

    • 0: Off

    • 1: On

  • showUIDs (int) –

    Show frame UIDs?

    • -2: Leave untouched

    • -1: Toggle

    • 0: Off

    • 1: On

  • showEdges (int) –

    Show frame edges?

    • -2: Leave untouched

    • -1: Toggle

    • 0: Off

    • 1: On

  • resolution (float) –

    Resolution of snapshots

    • 0.0: Leave untouched

    • else: Snapshot resolution in DPI.

      Values are delimited to the range (20.0 - 600.0)

Return type:

None

Raises:
Available:

InDesign®

CScript:

productlist::set_build_trace

comet.product.getBuildTrace()

Get the current values used for build tracing

Result:

The values in the following order (see parameters of setBuildTrace()):

(enabled, showNails, showUIDs, showEdges, resolution)

Return type:

tuple[bool, bool, bool, bool, float]

Available:

InDesign®

Raises:

CometError – On internal error

CScript:

productlist::get_build_trace