ItemAttributes objects are used to describe attributes of items to query for when using the document.getItems(attributes) function. It serves as a description of a filter applied to the queried items, defined by various fields that can either be set to true, false, or null.
Sample code:
// All selected paths and rasters contained in the document.
var selectedItems = document.getItems({
type: [Path, Raster],
selected: true
});
// All visible Paths contained in the document.
var visibleItems = document.getItems({
type: Path,
hidden: false
});
Properties
The type of items to search for. It can be set to any of the Item classes, a String describing the name of such a class, or an Array of either, describing a row of Item classes to match.
You can use PathItem to match both Path and CompoundPath, and TextItem to match all three types of text items ( PointText, AreaText and PathText).
- Accepts:
- Array of Class
- Array of String
- Class
- String
- Returns:
- Array of Class
Filters selected items when set to true, ignores selected items when set to false.
Sample code:
var selectedItems = document.getItems({
selected: true
});
var unselectedItems = document.getItems({
selected: false
});
- Returns:
- Boolean
Filters locked items when set to true, ignores locked items when set to false.
Sample code:
var lockedItems = document.getItems({
locked: true
});
var unlockedItems = document.getItems({
locked: false
});
- Returns:
- Boolean
- Returns:
- Boolean
Filters path items that define a clip mask when set to true, ignores them when set to false.
Sample code:
var clipMaskItems = document.getItems({
clipMask: true
});
var otherItems = document.getItems({
clipMask: false
});
- Returns:
- Boolean