Skip navigation
vectorid
Currently Being Moderated

Javascript create parent xml element from selection

Sep 14, 2012 8:50 PM

Hello,

 

With help from these forums I finally learned how to script creating a parent xml element from a selection in the Structure Pane.

 

var myDoc = app.activeDocument;
var mySel = app.selection;
 
var newParent = myDoc.xmlElements[0].xmlElements.add({markupTag:"c_bullet_list"}).move(LocationOptions.before, mySel[0]);
 
var i = mySel.length;
while(i--){
          mySel[i].move(LocationOptions.AT_BEGINNING, newParent);   
}

 

Hope this helps somebody.

 

More Like This

  • Retrieving data ...

Bookmarked By (0)