• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Apply tag to frame

Participant ,
Apr 12, 2017 Apr 12, 2017

Copy link to clipboard

Copied

Hi

I need to create tag apply tag to frame using javascript.

tags.PNG

Thanks

TOPICS
Scripting

Views

359

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Participant , Apr 26, 2017 Apr 26, 2017

  var doc = app.activeDocument;

  var frame = app.selection[0];

  var xmlElement = doc.xmlElements[0].xmlElements.add("send");

  frame.markup(xmlElement);

Votes

Translate

Translate
People's Champ ,
Apr 13, 2017 Apr 13, 2017

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();

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Apr 26, 2017 Apr 26, 2017

Copy link to clipboard

Copied

LATEST

  var doc = app.activeDocument;

  var frame = app.selection[0];

  var xmlElement = doc.xmlElements[0].xmlElements.add("send");

  frame.markup(xmlElement);

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines