Map tags to styles (CS6, Applescript)

I want to map a series of tags to styles in InDesign, but this seems not to work.
The inverse, mapping styles to tags, works!
Any idea? Thanks for your help!
tell application "Adobe InDesign CS6"
          tell active document
  make XML export map with properties {markup tag:"Header", mapped style:"Header"}
  map XML tags to styles
          end tell
end tell

Hello, try
tell application "Adobe InDesign CS6"
    set myDocument to active document
    tell myDocument
        set tList to name of every XML tag
        set tNumItems to count of tList
        -- XML tag to style mapping by name.
        repeat with j from 1 to tNumItems
            set tStyle to item j of tList
            make XML import map with properties {markup tag:tStyle, mapped style:tStyle}
        end repeat
        --Map tags to styles.
        map XML tags to styles
        --Map styles to XML tags by name
        repeat with j from 1 to tNumItems
            set tStyle to item j of tList
            make XML export map with properties {markup tag:tStyle, mapped style:tStyle}
        end repeat
        --Map styles to tags.
        map styles to XML tags
    end tell
    --Export xml para desktop para pasta a designar
    tell active document
        export to "xxxxxxxxx:aaaaaaaaa.xml" format "XML"
    end tell
end tell

Similar Messages

  • Js for Structure; XML; Map Tags to Styles...

    Hi all
    I am trying this forum entry again under a different heading. I may have confused readers.
    I have a ID file that contains XML content and lots of Character and Paragraph Styles.
    There is a map that connects Tags <-> Styles.
    This file is working fine. This file is now my "Template File"
    I have written a script that imports XML content of the same kind into a new file.
    The script also imports or loads all the Character and Paragraph Styles from the "Template File" into the "New File".
    Now I would like to import the maping between Tags <-> Styles into my "New File".
    Manually this is an easy process in ID, in the Structure pane, top right corner, is a pulldown, one of the commands is called "Map Tags to Styles..."
    I load the map and my "New File" looks perfect.
    I would now like to include this function into my script.
    So far I could not find any code samples for this.
    Can anybody help?
    Thanks Romano

    Thank you Fred
    No this imports the Tags only...
    what I am looking for is this:
    My script needs to "call this menu, press the Load... button, choose a file, import from that file"
    It would be some simple thing like loading the colour swatches from another file...
        app.activeDocument.loadSwatches(myStyleFile);  
    but would say something like     app.activeDocument."loadTagsStylesMap"(myStyleFile);  
    Romano

  • Map tags to style problem.

    Hello!
    I have a problem with indesign that i cannot understand. On the picture below, you can see my structure. PARAGRAPH is the tag of the text frame. Inside the text frame i have tagged the text. The things that should be paragraph style 1 (bröd) is tagged "PARAGRAPH1". The things that should be  paragraph style 2 (bröd_start) is tagged "PARAGRAPH2".
    I use map tags to style to map the different tags to a specific style. It looks like this:
    When I run the cursor over the text I can see the tags changing to the correct one in the tags panel. But the paragraph style is always "Bröd". It seems as if the tags to style is not applied!
    The reason that I want to to this is so I can manage first lines better. I map the first word of a "new" line to "Bröd_Start" so that the first line is aligned flush left. Like this:
    Anyone has any ideas why this is not working like it should?!
    Tank you!
    Regards,
    Lukas

    Hi,
    Thanks for sharing the document. I tried with your file and scrolling is working fine. I could choose and select the styles also.
    Did the bug happen after importing XML or before as well?
    Do you have other documents open while you are working on this document?
    Did you try cleaning your preferences and cache? If not, you can give this a try and let me know if the problem still remains.
    Regards,
    Pooja

  • Map styles to tags v. Map tags to styles

    Hi everyone,
    Indesign CS4 has an option in the tags panel to:
    1) Map styles to tags
    and
    2) Map tags to styles
    Does anyone know what the difference between these two options are?
    Appreciate any help.

    Tags and Styles serve two separate functions.
    A Tag defines data that belongs to a specific element and is enclosed with an opening and closing tag.
    example:  <element>  This copy will be used for a headline  </element>
    A Style defines how that data will appear with specific attributes: font, font size, color, etc.
    So, say I have an Indesign document that has a predefined paragraph style named: Headline (with attributes of Times New Roman Bold, 18 Point) and I import a file that is tagged like my example. I can map the tag "element" to the style "Headline" and the import can automate the process like this:
    This copy will be used for a headline

  • [CS2][JS] Map tags to styles

    Hi
    I would like to map styles to tags and map tags to styles using a predefined file....
    I've tried using ...
    var thepath="/Volumes/test/Mapping.indd";
    var myImportfile=new File(thepath);
    app.activeDocument.xmlImportMaps.add(myImportfile);
    app.activeDocument.xmlExportMaps.add(myImportfile);
    ... but it raises an error... missing parameter...
    Does anyone have an idea?
    Thanx
    Tim

    Hi Eric,
    I just checked the link, and it's working fine. Try again?
    Also, I'd missed this thread earlier--what Tim is asking about (loading a tag to style mapping from a file) can't be done directly in the user interface (as far as I can tell), so it can't be done directly from scripting. Instead, you'd have to open the file containing the tag to style mapping, then transfer the mapping one import/export map at a time to the target file.
    Thanks,
    Ole

  • Map Tags to Style Pallet Issue

    When in the 'Map Tags to Style' pallet I can't scroll by either moving the scroll bar or clicking up/down arrows. Also the only way to select a style sheet is to click exactly on the paragraph icon. The scrolling is driving me crazy, anyone else have this issue in this pallet in ID CC (using ID from cloud and all updates have been run)?

    Hi,
    Thanks for sharing the document. I tried with your file and scrolling is working fine. I could choose and select the styles also.
    Did the bug happen after importing XML or before as well?
    Do you have other documents open while you are working on this document?
    Did you try cleaning your preferences and cache? If not, you can give this a try and let me know if the problem still remains.
    Regards,
    Pooja

  • Map tags to styles by javascript

    Hi All,
    I need to ‘Map Tags to Styles’ is this possible by javascript?
    By
    hasvi

    Hello hasvi,
    What I understood in Jongware & Everyone statement. You expect everything into this forum, I seen you every post you always expecting or requesting any one to create the script or help. This is not good path to develop to your career. First you have learn then come to forum, then you have any problem, everybody ready to help to you share their knowledge.
    See your below threads Titles. You not share your any ideas to any one also your score is 0. You only get everything into this forum but you not share any small request also.
    How to import tables without 'xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/' this format.
    https://forums.adobe.com/thread/1534167
    How to import tables without 'xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/' this format.
    https://forums.adobe.com/thread/1533132?sr=stream&ru=2170596
    XML structure validation by javascript
    https://forums.adobe.com/thread/1533131?sr=stream&ru=2170596
    Please correct this script for call xml element
    https://forums.adobe.com/thread/1471266
    How to 'import xml' in my script
    https://forums.adobe.com/thread/1531896?sr=stream&ru=2170596
    Need script for "Convert bullets and numbering to text"
    Need script for "Convert bullets and numbering to text"
    Overflow text copy on next page with same anchore box by script
    hasvi
    Again I tell you that don't miss use this forum pls change the attitude. Everybody sharing their thoughts and Ideas to develop only.....
    I hope you understand?
    thx,
    csm_phil

  • Problem Mapping Tags to Styles in CS2

    Hello, I am running CS2 (V4.0.5) on XP SP2. I have XML-tagged text that I am mapping to styles/map by name. While the paragraph styles apply correctly, character style sheets that shouldn't apply are being applied as well. I have replicated this multiple times.

    Hi,
    Can you provide some text examples from your xml file. This because to identify the concern in the xml coding.
    Regards
    Thiyagu

  • Map by name, Tags to Styles

    In JavaScript, I can map Styles to Tags using autoTag but how do I map Tags to Styles by name?
    Thank you,
    Richard

    #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;

  • How to handle paragraph styles in imported text with no tagged paragraph styles

    Hi
    Im currently trying to import a file (word file / excel I have both formats) into an indesign book and formatting the text automatically!
    My question is: How is it possible to reflow text into frames and when changing frame it changes paragraph?
    Or how is it possible to change paragraph style when forcing a line break when using text reflow?
    I have already figured out how to reflow the text, and actually also managed to relow text into the frames and change paragraph style. I know how to use the keep option, and by this change the paragraph style when e.g. changing frame break/page break etc.  (but if the content being flowed-in is not tagged with style names then I cannot figure out how to do it) The document and its content I whish to import do not have any tagged paragraphs!
    Then I tried to look into "object styles" and format a text frame on a master page with an object style, and by using a "dilimiter character" forcing the text to start in a new frame when bringing the frame into live on a page. But here I cannot make the "text frame/object style" to apply or to work.
    If any of you have a hint, I would be more than happy to hear from you
    This picture are illustrating the outcome I would to get to....

    If the incoming text does not have styles, or has only one style, there is really not much you can do other than assign styles after the import. If there are recognizable patterns in the formatting, a lot of that can be done with Find/Change, and there are a few scripts floating around that can help automate some of that.
    Also, if your styles have a a good "next style" heirarchy built in, you can select large blocks of text (up to the point where applying next style would be incorrect), then right click the style name in the paragraph styles panel and choose apply style and next style (remove overrides). Warning. Removing overrides will remove any locally applied formatting like bold or italics, so local formatting should be converted to character styles first. Applied character styles are not overrides and will be preserved.

  • Map tags to object styles?

    Hello ID users & developers!
    Well, now i know that tags from imported xml can be mapped to corresponding paragraph or table styles of ID document.
    But, if i have to map any tag to an object style?
    I import images with <Image href='image_path' /> tag.
    Now, how can i bind it to Image object style?
    Thanks in advance, Alex.

    It does not.
    It would be nice though some day.

  • How do I assign different Epub export tags in InDesign CS6?

    I have at least 3 paragraph styles that I can not get to export the way I want them with InDesign CS6. I have my main paragraph style. Then another based on the main that I would like to have extra space before it. I did this in InDesign with a setting of 0.25 in in space before in the Indents and Spacing options. A third paragraph style I want to stand apart from the others with an indented right and left margins plus space above and below. It looks good in InDesign but when I export to Epub all 3 paragraphs look alike. I assume that I have to do something with the Edit All Export Tags settings but what?
    Thank you for any assistance someone can give me.

    I've moved your question to the InDesign EPUB forum.
    EXACTLY what version of CS6 are you running? There was a bug in an early version of CS6 that prevented either space before or space after from being recognized (I forget which). It was fixed in a later version.
    What does it say in the About InDesign dialog?

  • Tagging character styles and paragraph styles in inDesign

    I'm working on a complex book in which everything on the pages is styled.
    I've been asked to tag the vocabulary terms in the text, so that the correct page number shows up in the index.
    I've been asked to tag the folios as well, for the table of contents.
    The folios are a paragraph style.
    The vocabulary terms are styled with a character style.
    How do I do this?
    Any help much appreciated.

    InDesign's built-in Table of Contents function picks up text based on paragraph styles. I'm not sure you really men, though, that you want to pick up the folios, if you are using the term as I understand it, to mean the page numbers. You really want to pick up the various headings used to identify the topics or titles. ID will supply the page numbers.
    As for the indexing, there may be a script that can find text with a particular character style assigned and add it to an index (you should ask over in the scripting forum: InDesign Scripting) but you should also read the Help on Indexes and learn more about how they operate.

  • Help needed for Graphical mapping.Tag only once produces

    Hello experts,
    I have a problem in my graphical mapping.This is the example:
    from each segment A in IDOC has to be made Tag A or Tag B in output XML.
    Segment A has a field USER_STATUS and if it is X than Tag B has to be made otherwise Tag A.
    Segment A is 0..9999999. occurence
    Tag A  0..unbounded
    Tag B 0..unbounded.
    I made a mapping
    mapping for Tag A:
    USER_STATUS -> mapwith default(empty)->length->EqualsA (with Constant =0)-> createif->Tag A
    for Tag B as following:
    USER_STATUS -> mapwith default(empty)->EqualsS (with Constant =X)-> createif->Tag B
    The problem is that in output XML, I have only one Tag A or B (depending on field USER_STATUS in first occurence of the segment) while in inbound IDOC 5 segments are with different value of the field: USER_STATUS.
    Does anyone idea to solve this problem!
    Thank you very much for your effort.
    King regards,
    Danijela Zivanovic

    HI,
    CAn you try this way,
    Use Maping Node UseOneAsMany for Tag B
    and pass 3 inputs as
    Constant[]----
    >
    USER_STATUS -> mapwith default(empty)->EqualsS (with Constant =X)----
    >
    USER_STATUS -> mapwith default(empty)->EqualsS (with Constant =X)----
    >
    Same way try for Tag A also.
    Thanks
    Swarup

  • Parsing XML with html tags for style

    I'm using flash to pull in XML data, but I want to use html
    tags to be able to style the text. When I add any html, it treats
    it as a sub-node and ignores the data. Also, line breaks in the xml
    are being converted to double spaced paragraphs? The relevant code
    is basically this:
    if (element.nodeName.toUpperCase() == "TEXT")
    {//add text to text array
    ar_text[s]=element.firstChild.nodeValue;
    textbox1.text = ar_text[0];

    try to use htmlText instead text... like this:
    textbox1.htmlText = ar_text[0]
    adam

Maybe you are looking for

  • A whine (and veiled query for advice)

    A longish time ago, in a state far away..... I had a license to Photoshop, the bee's knees of creative software. (an even longer time ago, in another universe, I used PageMaker 1.0 on a Mac 512 with internal and extermal floppy drives and no hard dis

  • What to do with low disk space warning?

    My Time Capsule is blinking amber because of low disk space. Isn't it supposed to delete the oldest files to make more room? What should I do at this point?

  • Missing color profile

    Hello, I am running CS at my job. 4 days ago, Photoshop started asking for color profiles on every single image I open. Most of these images are ones that I have used repeatedly in the past with no errors or missing profile messages. My question....?

  • Prtdiag: not implemented on SUNW,T5240

    Has anyone seen the above error? I have seen and rectified the prtdiag error on the Solaris 10 ldoms but I can not run prtdiag on a Solaris 9 container. Is there a work around or way to fix this? Thanks

  • Slow MBP. Should I upgrade to a new computer?

    Hi all, Situation: I have one of the very first macbook pros with 1.83ghz core duo, 80 gig hard drive and upgraded 2gb of ram. Lately, my workhorse of a mac has been slowing WAAAAAAAY down or freezing, specifically, while using keynote and numbers at