Skip to main content
Participating Frequently
February 4, 2009
Question

map by name, Tags to Styles

  • February 4, 2009
  • 6 replies
  • 1220 views
In JavaScript, I can map Styles to Tags using autoTag but how do I map Tags to Styles by name?

Thank you,
Richard
This topic has been closed for replies.

6 replies

Participating Frequently
February 7, 2009
Stefan,
Thank you, I will try it also.

Richard
srakete
Inspiring
February 6, 2009
Richard,
another way to go is with the XMLExportMap

Stefan
Participating Frequently
February 6, 2009
Thank you Kasyan, at first glance this is working well. Let me pass it through some more exercises and I will report.

Thanks again,
Richard
Kasyan Servetsky
Legend
February 5, 2009


#target indesign
#include "/Applications/Adobe InDesign CS3/Scripts/Xml Rules/glue code.jsx"
var myDocument = app.activeDocument;

var myRuleSet = new Array (new ProcessAll);

with(myDocument){
var elements = xmlElements;
__processRuleSet(elements.item(0), myRuleSet);
}

myDocument.mapXMLTagsToStyles();

function ProcessAll(){
this.name = "ProcessAll";
this.xpath = "//*";
this.apply = function(myElement, myRuleProcessor){
with(myElement){
$.writeln(markupTag.name);
var myParagraphStyle = myDocument.paragraphStyles.itemByName(markupTag.name);
if (myParagraphStyle != null){
myDocument.xmlImportMaps.add(markupTag.name, markupTag.name);
}
}
return true;
}
}
Participating Frequently
February 5, 2009
Hi Kasyan,

Hum...I probably did not explain myself very well.

Assume that tags have been created matching all paragraphs and characters styles and that "Map Styles to Tags" is done with "Map by Name". The only thing left for me to do, is now to "Map Tags to Styles" with "Map by Name". This last step is where I fail.

Thanks,
Richard
Kasyan Servetsky
Legend
February 5, 2009
Hi Richard,

Check out MapTagsToStyles.jsx example script from here:
http://wwwimages.adobe.com/www.adobe.com/products/indesign/scripting/downloads/indesign_cs3_guide_scripts.zip

Kasyan