comet.frame¶
The comet.frame module provides access to document frame processing functionality
Methods¶
- comet.frame.getSelected(children=False, placeHolderIDs=[], layers=[], cometGroupIDs=[])¶
Get a list of all currently selected frames applying various filters.
- Parameters:
children (bool) – Include subframes aswell?
Restrict the result to frames with these placeholders.
Empty list: Impose no restrictions
[-1]: Allow all frames which have any placeholder
Restrict the result to frames on these layers.
The list can contain:
Empty list : Do not impose restrictions
Restrict the result to frames of these comet groups.
Empty list: Impose no restrictions
[-1]: Allow all frames which are part of any comet group
- Returns:
The found frames
- Return type:
- Raises:
TypeError – When parameter types are invalid
CometError – On internal error
- Available:
InDesign® Illustrator®
- CScript:
- comet.frame.createTextFrame(dimensions, document=None, page=0, layer='', columns=1, gutter=-1.0, vertical=False)¶
Create a new text frame.
InDesign® comet_pdf®
If the script frame (gFrame) is a member of a Comet group and is on the same spread as the newly created frame, the new frame will become a member of this Comet group aswell.
If a column number larger than 0, columns will be automatically set up in the frames with the spacing gutter.
If the spacing is smaller than 0, the default spacing will be used.
- Parameters:
dimensions (tuple[float, float, float, float] | CRect) –
The coordinates of the new frame relative to the page margins.
The parameter type can be:
document (None | CDocument) –
The document to create the frame in
The parameter type can be:
page –
The target page to create the frame on.
The parameter type can be:
layer (str | list[str] | CLayer) –
The layer to create the frame on.
The parameter type can be:
columns (int) –
Column count.
Illustrator® Ignored.
gutter (float) –
Column spacing.
Illustrator® Ignored.
vertical (bool) –
Vertical text?
Illustrator® Ignored.
- Returns:
The newly created frame
- Return type:
- Raises:
TypeError – When parameter types are invalid
When parameter dimensions has invalid values
When parameter page has invalid value
When parameter columns has invalid value
When parameter gutter has invalid value
CometError – On internal error
- Available:
InDesign® comet_pdf® Illustrator®
- CScript:
- comet.frame.createImageFrame(dimensions, document=None, page=0, layer='')¶
Create a new empty image frame.
InDesign® comet_pdf®
If the script frame (gFrame) is a member of a Comet group and is on the same spread as the newly created frame, the new frame will become a member of this Comet group aswell.
Illustrator® Since there are no empty image frames in Illustrator, this behaves like the menu item Object->priint:comet->Insert placeholder image
- Parameters:
dimensions (tuple[float, float, float, float] | CRect) –
The coordinates of the new frame relative to the page margins.
The parameter type can be:
document (None | CDocument) –
The document to create the frame in
The parameter type can be:
page –
The target page to create the frame on.
The parameter type can be:
layer (str | list[str] | CLayer) –
The layer to create the frame on.
The parameter type can be:
- Returns:
The newly created frame
- Return type:
- Raises:
TypeError – When parameter types are invalid
When parameter dimensions has invalid values
When parameter page has invalid value
CometError – On internal error
- Available:
InDesign® comet_pdf® Illustrator®
- CScript:
- comet.frame.createGroup(objects)¶
Group a selection of document items.
InDesign® comet_pdf® The function can group items only if all items are on the same spread.
If the items are part of a group, they can only be grouped with items of the same parent group.
If an item of the list is locked, all items of the new group will be locked.
- Parameters:
- Returns:
The newly created group
- Return type:
- Raises:
When parameter types are invalid
When parameter objects is empty list
CometError – On internal error
- Available:
InDesign® comet_pdf® Illustrator®
- CScript:
- comet.frame.createCometGroup(frames)¶
Create a Comet group from a list of frames. Old memberships are overwritten without exceptions.
- Parameters:
- Returns:
The newly created comet group
- Return type:
- Raises:
TypeError – When parameter types are invalid
CometError – On internal error
- Available:
InDesign® comet_pdf® Illustrator®
- CScript:
- comet.frame.getBBox(items, spreadRelative=False, lastPageOrSpread=False, spreadWide=False)¶
This function is the same as
CPageItem.getBBox()
, except it operates on a list of CPageItem objects and returns the union of their bounding boxes.InDesign® comet_pdf® Bounding boxes are only determined page- or spread-wide!
If the item list contains entries of different pages or spreads, only the items of the first/last page or spread are used to determine the bounding box.
- Parameters:
frames (list[CPageItem]) – The items to get the bounding box for
spreadRelative (bool) –
Get the coordinates relative to the page or to the spread?
Illustrator® Ignored
lastPageOrSpread (bool) –
Use items of first or last page/spread in case of multiple pages or spreads?
Illustrator® Ignored
spreadWide (bool) –
If the item list contains items of different pages, should the items of the first/last page be used or the items of the first/last spread?
Illustrator® Ignored
- Returns:
The bounding box
- Return type:
- Raises:
TypeError – When parameter types are invalid
CometError – On internal error
- Available:
InDesign® comet_pdf® Illustrator®
- See also:
- CScript:
- comet.frame.moveTo(frames, x, y, page=-1)¶
This function is the same as
CFrame.moveTo()
, except it operates on a list of CFrame objects.Warning
If the list contains frames of different pages, only the frames of the first page are processed. This also applies if the pages belong to the same spread. The background to this is to avoid, as far as possible, that frames of pages fall into the work area.
Warning
When moving frames to a new page, the comet groups of these frames are lost.
- Parameters:
- Return type:
None
- Raises:
TypeError – When parameter types are invalid
ValueError – When page is int and has invalid index.
CometError – On internal error
- Available:
InDesign® comet_pdf® Illustrator®
- See also:
- CScript: