Tags
app.activeDocument.selection[index].tags
Description
Section titled “Description”A collection of Tag objects.
Properties
Section titled “Properties”Tags.length
Section titled “Tags.length”app.activeDocument.selection[index].tags.length
Description
Section titled “Description”The number of elements in the collection.
Number; read-only.
Tags.parent
Section titled “Tags.parent”app.activeDocument.selection[index].tags.parent
Description
Section titled “Description”The object’s container.
Object; read-only.
Tags.typename
Section titled “Tags.typename”app.activeDocument.selection[index].tags.typename
Description
Section titled “Description”The class name of the referenced object.
String; read-only.
Methods
Section titled “Methods”Tags.add()
Section titled “Tags.add()”app.activeDocument.selection[index].tags.add()
Description
Section titled “Description”Creates a new Tag object.
Returns
Section titled “Returns”Tags.getByName()
Section titled “Tags.getByName()”app.activeDocument.selection[index].tags.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”Tags.index()
Section titled “Tags.index()”app.activeDocument.selection[index].tags.index(itemKey)
Description
Section titled “Description”Gets an element from the collection.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
itemKey | String, Number | String or number key |
Returns
Section titled “Returns”Tags.removeAll()
Section titled “Tags.removeAll()”app.activeDocument.selection[index].tags.removeAll()
Description
Section titled “Description”Deletes all elements in this collection.
Returns
Section titled “Returns”Nothing.
Example
Section titled “Example”Setting tag values
Section titled “Setting tag values”// Adds tags to all RasterItems and PlacedItems in the current documentif ( app.documents.length > 0 ) { var doc = app.activeDocument;
if ( doc.placedItems.length + doc.rasterItems.length > 0 ) { for ( i = 0; i < doc.pageItems.length; i++ ) { var imageArt = doc.pageItems[i];
if ( imageArt.typename == "PlacedItem" || imageArt.typename == "RasterItem") { // Create a new Tag with the name AdobeURL and the // value of the www link
var urlTAG = imageArt.tags.add(); urlTAG.name = "AdobeWebSite"; urlTAG.value = "http://www.adobe.com/"; } } } else { alert( "No placed or raster items in the document" ); }}