Copy link to clipboard
Copied
Hi
I need to create tag apply tag to frame using javascript.
Thanks
var doc = app.activeDocument;
var frame = app.selection[0];
var xmlElement = doc.xmlElements[0].xmlElements.add("send");
frame.markup(xmlElement);
Copy link to clipboard
Copied
Have you even tried to do something out of your hands ?
var main = function() {
var doc = app.properties.activeDocument,
sel, n, p, t, xe, item;
if ( !doc || !app.selection.length) return;
sel = app.selection;
n = app.selection.length;
p = prompt ( "Let's set some name for our tag…" , 'yo', 'Create a tag' );
if ( !p ) return;
//one should check for tag name validity
t = doc.xmlTags.itemByName ( p );
!t.isValid && t = doc.xmlTags.add( p );
while ( n-- ) {
//Normally would avoid try/catch and inspect items but being lazy here
item = sel
; try {
item.autoTag();
xe = item.properties.associatedXMLElement;
!xe && xe = item.properties.associatedXMLElements[0];
xe.markupTag = t;
}
catch(err) {
}
}
}
main();
Copy link to clipboard
Copied
var doc = app.activeDocument;
var frame = app.selection[0];
var xmlElement = doc.xmlElements[0].xmlElements.add("send");
frame.markup(xmlElement);