2 Replies Latest reply on Sep 6, 2016 4:26 PM by KenWK

    Mapping Styles to tags, checking for unmapped

    KenWK Level 1

      I've been unable to find any info on scripting the mapping of styles to tags.

       

      I currently have a standing InD file that has all the styles mapped to tags. I've been using the Load button on the "Map Styles to Tags" dialog to load the

      mappings into the file I want to export. This works OK but unfortunatly loads the ENTIRE style from the standing file, including formatting. I want JUST the style mappings to the tags from the standing file and maintain the formatting of the file I'm getting prepared for export.

       

      I'd be most grateful if someone could supply a small code snippet or even some info as to where to look for scripting the mapping.

       

      Related to that I'd like to script finding styles that are NOT mapped to any XML tag for when a new style if introduced.

       

      Many thanks for reading,
      Ken

        • 1. Re: Mapping Styles to tags, checking for unmapped
          G. Singelmann Level 3
          main();
          
          
          function main() {
            var doc = app.activeDocument;
            var xm1 = doc.xmlExportMaps.add( "H2", "h2");
            var xmaps = doc.xmlExportMaps;
            $.writeln("count maps: " + xmaps.length);
            for (var m = 0; m < xmaps.length; m++) {
                 var a = doc.xmlExportMaps.item(m);
                 for (var n in a ) {
                      if (a[n].hasOwnProperty('name')) {
                           $.writeln( n + ": " + a[n].name );
                      } else {
                           $.writeln( n + ": " + a[n] );
                      }
                 }
            $.writeln( "----" );
            }
          }
          

           

           

          Does that help?

          • 2. Re: Mapping Styles to tags, checking for unmapped
            KenWK Level 1

            Oy! That's a bit embarrassing.

             

             

            Thanks so much for the illustration, every thing is working fabulously, mapping and checking for unmapped.

             

             

            So, any idea of there is a way to change the color that's displayed for the XML "markings"? Not critical but it would be nice to be able to set them to something so they're consistent.

             

             

            Thanks again for the example,

            Ken