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

Mapping Styles to tags, checking for unmapped

Engaged ,
Aug 19, 2016 Aug 19, 2016

Copy link to clipboard

Copied

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

TOPICS
Scripting

Views

387

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

Engaged , Aug 21, 2016 Aug 21, 2016

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.hasOwnProperty('name')) {

                 $.writeln( n + ": " + a.name );

            } else {

                 $.writeln( n + ": " + a );

            }

       }

  $.writeln( "----" );

  }

}

Does that hel

...

Votes

Translate

Translate
Engaged ,
Aug 21, 2016 Aug 21, 2016

Copy link to clipboard

Copied

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.hasOwnProperty('name')) {

                 $.writeln( n + ": " + a.name );

            } else {

                 $.writeln( n + ": " + a );

            }

       }

  $.writeln( "----" );

  }

}

Does that help?

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
Engaged ,
Sep 06, 2016 Sep 06, 2016

Copy link to clipboard

Copied

LATEST

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

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