Spots
app.activeDocument.spots
Description
Section titled “Description”A collection of SpotColor objects in a document.
Properties
Section titled “Properties”Spots.length
Section titled “Spots.length”app.activeDocument.spots.length
Description
Section titled “Description”Number of elements in the collection.
Number; read-only.
Spots.parent
Section titled “Spots.parent”app.activeDocument.spots.parent
Description
Section titled “Description”The object’s container.
Object; read-only.
Spots.typename
Section titled “Spots.typename”app.activeDocument.spots.typename
Description
Section titled “Description”The class name of the object.
String; read-only.
Methods
Section titled “Methods”Spots.add()
Section titled “Spots.add()”app.activeDocument.spots.add()
Description
Section titled “Description”Creates a new object.
Returns
Section titled “Returns”Spots.getByName()
Section titled “Spots.getByName()”app.activeDocument.spots.getByName(name)
Description
Section titled “Description”Get the first element in the collection with the provided name.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
name | String | Name of element to get |
Returns
Section titled “Returns”Spots.index()
Section titled “Spots.index()”app.activeDocument.spots.index(itemKey)
Description
Section titled “Description”Gets an element from the collection.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
itemKey | String, Number | Key of element to get |
Returns
Section titled “Returns”Spots.removeAll()
Section titled “Spots.removeAll()”app.activeDocument.spots.removeAll()
Description
Section titled “Description”Deletes all elements in the collection.
Returns
Section titled “Returns”Nothing.
Example
Section titled “Example”Removing spot colors
Section titled “Removing spot colors”// Deletes all spots colors from the current documentif ( app.documents.length > 0 ) { var spotCount = app.activeDocument.spots.length;
if (spotCount > 0) { app.activeDocument.spots.removeAll(); }}
Creating and applying spot colors
Section titled “Creating and applying spot colors”// Defines and applies a new spot color in the current document,// then applies the color to the first path itemif (app.documents.length > 0 && app.activeDocument.pathItems.length > 0) { // Define the new color value var newRGBColor = new RGBColor(); newRGBColor.red = 255; newRGBColor.green = 0; newRGBColor.blue = 0;
// Create the new spot var newSpot = app.activeDocument.spots.add();
// Define the new SpotColor as 80% of the RGB color newSpot.name = "Scripted Red spot"; newSpot.tint = 80; newSpot.color = newRGBColor;
// Apply a 50% tint of the new spot color to the frontmost path item. // Create a spotcolor object, set the tint value, var newSpotColor = new SpotColor(); newSpotColor.spot = newSpot; newSpotColor.tint = 50;
// Use the spot color to set the fill color var frontPath = app.activeDocument.pathItems[0]; frontPath.filled = true; frontPath.fillColor = newSpotColor;}