🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #1540

Re: map by name, Tags to Styles

#1540
From: Kasyan_Servetsky
Date: Thu, 05 Feb 2009 19:24
31 lines
1396 bytes


 
#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;
   }
}
Technical Details
Message-ID: <59b7c7a9.2@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!newshub.sdsu.edu!webcrossing
References: <59b7c7a9.-1@webcrossing.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,93ea016a6ca352a7
X-Google-Attributes: gidf939a,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: Kasyan_Servetsky@adobeforums.com
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!newshub.sdsu.edu!webcrossing
Newsgroups: adobe.scripting.indesign
Subject: Re: map by name, Tags to Styles
Message-ID: <59b7c7a9.2@webcrossing.la2eafNXanI>
Date: Thu, 5 Feb 2009 11:24:40 -0800
References: <59b7c7a9.-1@webcrossing.la2eafNXanI>
Lines: 19
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit