标签
app.activeDocument.selection[index].tags[index]
与特定艺术作品相关联的标签。
标签允许您为文档中的任何页面项分配无限数量的键值对。
Tag.name
Section titled “Tag.name”app.activeDocument.selection[index].tags[index].name
标签的名称。
字符串;只读。
Tag.parent
Section titled “Tag.parent”app.activeDocument.selection[index].tags[index].parent
包含此标签的对象。
对象;只读。
Tag.typename
Section titled “Tag.typename”app.activeDocument.selection[index].tags[index].typename
对象的类名。
字符串;只读。
Tag.value
Section titled “Tag.value”app.activeDocument.selection[index].tags[index].value
存储在此标签中的数据。
字符串;只读。
Tag.remove()
Section titled “Tag.remove()”app.activeDocument.selection[index].tags[index].remove()
删除此对象。
无。
// 查找与所选艺术作品相关联的标签,// 在一个单独的文档中显示名称和值
if ( app.documents.length > 0 ) { doc = app.activeDocument;
if ( doc.selection.length > 0 ) { for ( i = 0; i < selection.length; i++ ) { selectedArt = selection[0]; tagList = selectedArt.tags;
if (tagList.length == 0) { var tempTag = tagList.add(); tempTag.name = "OneWord"; tempTag.value = "anything you want"; }
// 创建一个文档并为每个标签添加一行文本 reportDocument = app.documents.add(); top_offset = 400;
for ( i = 0; i < tagList.length; i++ ) { tagText = tagList[i].value; newItem = reportDocument.textFrames.add(); newItem.contents = "标签: (" + tagList[i].name + " , " + tagText + ")"; newItem.position = Array(100, top_offset); newItem.textRange.size = 24; top_offset = top_offset - 20; } } }}