Multiple Hyperlinks in Tagged Text file

Hi,
I'm currently exporting a contact directory database from sql into tagged text so I can import it into InDesign and format it up automatically and unltimately export as pdf.
So far I have got all the formatting working exactly as I want it to by reverse enginerring an exported file, but now I want to make all the e-mail addresses into hyperlinks.
I;ve included below an example of what i'm now importing into InDesign, all works and is formatting ok but the hyperlinks aren't being transferred properly.
Please could somebody advise me on the correct syntax on how to do the above, as I've read the tagged text user guide which gave me the headings to use but now an example of how to make a hyperlink.
One thing worth mentioning is that I am creating the number in the "HyperlinkDestKey" sequentially when outputting the text, not sure if this might have some bearing on the problem. Also open to any suggestions on trimming unncessary tags from the hyperlink too.
<ParaStyle:Quick Reference\:Company Grey>248A<0x2002>Company 1<0x0009>00
<ParaStyle:Quick Reference\:Quick ref text>Tel: 1 23 456 789<0x2002>Fax: 1 123 456 789
<ParaStyle:Quick Reference\:Quick ref text>Emergency Number - Tel: 123 456 798
<ParaStyle:Quick Reference\:Quick ref text>Pro:<0x00A0>Mr.<0x00A0>Jo<0x00A0>Bloggs<0x2002>PRO Email<0x00A0><Hyperlink:=<HyperlinkName:jobloggs\@company1.com><HyperlinkDest:mailto\:job loggs\%40company1.com\?subject\=><HyperlinkDestKey:3><CharStyleRef:><HyperlinkLength:21><H yperlinkStartOffset:0><Hidden:0><BrdrVisible:0><BrdrWidth:Thin><BrdrHilight:None><BrdrStyl e:Solid><BrdrColor:0\,0\,0>>[email protected]
<ParaStyle:Quick Reference\:Company Grey>248B<0x2002>Company 2,Los<0x00A0>Angeles<0x0009>00
<ParaStyle:Quick Reference\:Quick ref text>Tel: 123456789<0x2002>Fax: 12345679
<ParaStyle:Quick Reference\:Quick ref text>Emergency Number - Tel: 123456798
<ParaStyle:Quick Reference\:Quick ref text>Pro:<0x00A0>Ms.<0x00A0>Freda<0x00A0>Jones<0x2002>PRO Email<0x00A0><Hyperlink:=<HyperlinkName:fjones\@company2.com><HyperlinkDest:mailto\:fjone s\%40company2.com\?subject\=><HyperlinkDestKey:4><CharStyleRef:><HyperlinkLength:19><Hyper linkStartOffset:0><Hidden:0><BrdrVisible:0><BrdrWidth:Thin><BrdrHilight:None><BrdrStyle:So lid><BrdrColor:0\,0\,0>>[email protected]
<ParaStyle:Quick Reference\:Company Grey>248C<0x2002>Company3,New<0x00A0>York<0x0009>00
<ParaStyle:Quick Reference\:Quick ref text>Tel: 987654321<0x2002>Fax: 987654321
<ParaStyle:Quick Reference\:Quick ref text>Emergency Number - Tel: 987654321
<ParaStyle:Quick Reference\:Quick ref text>Pro:<0x00A0>Mrs.<0x00A0>Darlena<0x00A0>McManus<0x2002>PRO Email<0x00A0><Hyperlink:=<HyperlinkName:dmcmanu\@company3.com><HyperlinkDest:mailto\:dmcm anu\%40company3.com\?subject\=><HyperlinkDestKey:5><CharStyleRef:><HyperlinkLength:20><Hyp erlinkStartOffset:0><Hidden:0><BrdrVisible:0><BrdrWidth:Thin><BrdrHilight:None><BrdrStyle: Solid><BrdrColor:0\,0\,0>>[email protected]
Kind Regards
Steve Tucker

So it does. It also drops it if you export in GB 18030. I would file a bug report:
https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform
Only workaround I can think of would be to enter some other unique character (maybe |?) and find/replace it in ID after bringing in the tagged text.
Ken
Hold on, I tried exporting tagged text and then bringing it back in. It's not dropping the forced line break. It's exporting it as a single Line Feed (hex 0a). And it interprets that as a forced line break when importing back in. My text editor ignores Line Feeds. I had to look at it in a hex editor to see the 0a.
I don't know if that helps any. However you're producing the tagged text, you would need to be able to make it enter a line feed without the carriage return.
Ken

Similar Messages

  • How do I import an InDesign tagged text file into multiple pages and export as .ps or .pdf using Jav

    I have an InDesign tagged text file I've translated from .xml. I need to automate the following steps:
    1 - access specific InDesign template (eg. ABC_template.ind)
    2 - import tagged text file into InDesign
    3 - autoflow text to END of document (normally around 3-5 pages)
    4 - save document as either .ps or .pdf file
    5 - where the input file stub name matches the output stub name (eg., OrigName.txt outputs as OrigName.pdf).
    I would like to completely automate this whole process using JavaScript (because I don't know anyone that knows AppleScript). I've automated the first part using a perl script. I've been trying to find sample snipits of JavaScript that would do one or more of the items listed above, but am having a hard time finding what I need.
    Please, I'm desperate!! Can any of you InDesign scripting guru's out there help me??
    Thanks in advance!!
    LindaD

    Hi Linda,
    I might be able to help you out. You can contact me by email (click on my user name for the address), or if you post your email here.

  • Linked Adobe Tagged Text files importing without styles

    I have several data-heavy weekly publications where suddenly, the link to all Adobe Tagged Text format files have the proper paragraph styles and character styles stripped on being placed.  I'm aware of the default settings issue, where you deselect all and make sure the character styles is none, and that does not seem to be the issue. Specifics are
    Working in CS 5 (Version 7.0.4)
    The Adobe Tagged Text format files are exported from Excel spreadsheets
    The InDesign documents have links to the Adobe Tagged Text format files, and Update Link is used inside InDesign to update the text when the file is exported from the spreadsheet.
    When the publications are opened on my workstation, ALL files linked to Adobe Tagged Text files are not imported correctly, they revert to the Basic Paragraph style.
    These are not new documents I'm designing or new Adobe Tagged Text files, this is part of a production process that has worked without issue for years.
    When the same documents are opened on another workstation, and Update Links used, they come in perfectly, so it doesn't seem to be a document or file corruption problem, but a problem with my environment or ID settings.
    It's not one specific document or file, it is every single document that has a link to an Adobe Tagged Text file (and we have lots, I tried several!)
    I've opened the text files in the text editor to check them, but as I mentioned: same document, same files, I'm the only one who can't update without stripping out the styles.
    Thanks! Nancy

    Hi, Peter! Thanks for the response. Yes, it's really Tagged Text. See below. After exporting from the spreadsheet and database, opening the document in InDesign, and selecting update link, we do no editing in InDesign after the fact because everything is already setup exactly as we want it with the Tagged Text format.
    I have literally hundreds of these among several different documents, updated weekly, mainly dealing with prices and numbers. Every one of the links to Tagged Text format files in every publication now strips out the Tagged Text paragraph style and character style formatting on Update Link on my workstation only. On my other two workstations, the links update without issue, and everything is correct in the final document.
    So I'm beginning to think I need to look at rebuilding something, maybe as Joel said, replacing preferences. I keep looking for a workstation or ID option that might effect this.
    <ANSI-WIN>
    <vsn:6><fset:InDesign-Roman><ctable:=<Black:COLOR:CMYK:Process:0,0,0,1>>
    <dps:Pnl Comp\:Pnl Comp \$Numbers=<Nextstyle:Pnl Comp\:Pnl Comp \$Numbers>>
    <dps:Pnl Comp\:Pnl Comp Bold \$Numbers=<BasedOn:Pnl Comp\:Pnl Comp \$Numbers><Nextstyle:Pnl Comp\:Pnl Comp Bold \$Numbers>>
    <dps:Pnl Comp\:Pnl Group \$Numbers=<BasedOn:Pnl Comp\:Pnl Comp \$Numbers><Nextstyle:Pnl Comp\:Pnl Group \$Numbers>>
    <pstyle:Pnl Comp\:Pnl Comp Bold \$Numbers> $302 $302 $278
    <pstyle:Pnl Comp\:Pnl Group \$Numbers> 203 202 211
    <pstyle:Pnl Comp\:Pnl Group \$Numbers> 456 458 393

  • Soft return in tagged text file

    Hi, anyone has example of using a End of line (soft return)  in tagged text file?
    i tried using <0x000A> but it does not work. Advice needed.
    Tkz

    So it does. It also drops it if you export in GB 18030. I would file a bug report:
    https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform
    Only workaround I can think of would be to enter some other unique character (maybe |?) and find/replace it in ID after bringing in the tagged text.
    Ken
    Hold on, I tried exporting tagged text and then bringing it back in. It's not dropping the forced line break. It's exporting it as a single Line Feed (hex 0a). And it interprets that as a forced line break when importing back in. My text editor ignores Line Feeds. I had to look at it in a hex editor to see the 0a.
    I don't know if that helps any. However you're producing the tagged text, you would need to be able to make it enter a line feed without the carriage return.
    Ken

  • Import ID tagged text file results in paragraph style overrides

    I have been working on a project that requires the import of a large amount of information from a database. I have defined all the paragraph styles in InDesign and have a program to apply the paragraph style to the database information creating the InDesign Tagged Text file. When I place it into my document the paragraph styles are recognized but there is an override. If I clear the override, the text looks fine. I have an example document that I have exported and imported some text to rule out the program, but even in this case, an override occurs. Text is there, the paragraph format is there, but font size (for example) is wrong. Where should I be looking to correct this issue?
    Harold

    I don't recognize any of those being wrong, per se. I have the file on another computer, so I mocked up yet another one. Sorry
    Again in this one I did ASCII export, no fancy characters. And this one demonstrates the problem, too. I have two kinds of paragraphs. A big one and a small one. I create those paragraph styles. I select the only two lines in the file. Export and then bring them in underneath themselves to compare.
    The paragraph styles for the newly Placed paragraphs are gone. The font color is the same. But the font size and font have not changed.
    I manually edited the IDTT and removed the <Japanese feature> tag. Placed it again. Font color is the same, but the size and font are wrong.
    In other words, my problem is that ID does not seem to apply the paragraph style to the text when it is imported. Aren't the font size and font defined in the Paragraph Style?
    My end goal is to define some paragraph styles and create the IDTT automatically from a database. My hope was that the paragraphs would be formated properly based on the predefined styles when the IDTT comes in. I cannot get it to do this even for a pared down example. Aren't other users doing this?
    Here is the IDTT on pastebin (with the <Japanese...> tag removed)
    http://pastebin.com/Vdc6NVDV
    And what it looks like after the intial Place with <Japanese...> tag in, edited line from Small to "Deleted Japanese feature...", removed tag from IDTT and then did another Place.

  • Hyperlinks in tagged text

    Good morning,
    I'm building tables of contents programmatically and save them as tagged text for importing into InDesign (CS3) for later export to PDF.
    That works fine for bookmarks and hyperlinks to web sites but not for links to other PDF documents. Why?
    In fact if you create bookmarks, http://hyperlinks and file://links in InDesign, they work in PDF, but when you export it as tagged text and then re-import that same tagged text again, the first two still work but the file://links are lost. Why?
    Another funny point: file://links insist on *.indd targets even though the resulting PDF file will look for *.pdf one. Why?
    Thanks for any enlightenment, Texane02

    So it does. It also drops it if you export in GB 18030. I would file a bug report:
    https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform
    Only workaround I can think of would be to enter some other unique character (maybe |?) and find/replace it in ID after bringing in the tagged text.
    Ken
    Hold on, I tried exporting tagged text and then bringing it back in. It's not dropping the forced line break. It's exporting it as a single Line Feed (hex 0a). And it interprets that as a forced line break when importing back in. My text editor ignores Line Feeds. I had to look at it in a hex editor to see the 0a.
    I don't know if that helps any. However you're producing the tagged text, you would need to be able to make it enter a line feed without the carriage return.
    Ken

  • Pre-tagging text files for FrameMaker 11

    In older versions of FrameMaker I used to be able to pre-tag a text/data file using @tag name=[paratext] at the beginning of a paragraph so that when the file was imported to a FrameMaker template, the specified tag would be applied automatically and I didn't have to apply the tags manually. This doesn't seem to work any more, but I can't believe this feature is no longer available. How do I do the same thing for FrameMaker 11 please?

    The include statement at the top of an MML file is optional, but handy if you do a lot of MML work and always use the same styles. For occasional work or document with a "novelty" style-set, it's enough to put a <!DefineTag> slug at the top of the MML source for each style. Just remember to start the file with <MML> – the FM import scrutinises the file rather than relying on the extension – and to save it as ANSII. Oh, and I've noticed/learnt that if you don't leave a blank line between each tagged paragraph in the input, FM adds a space at the end of the paragraph. (showing my age – I've been sternly warned against increasing file-size with this sort of thing)
    I use MML a lot, for cleaning up – erm – enthusiastically formatted or completely unformatted .doc files, and apart from missing support for tables I find it a valuable blade on my FM Swiss Army knife <g> Minimal work with a text editor can convert an MML file into tagged text suitable for InDesign. Haven't had the occasion to experiment with IDD to MML, but who knows … that might work too.
    Just for completeness, a small example:
    <MML>
    <!DefineTag :h2>
    <!DefineTag :p>
    <!DefineTag :ul>
    <!DefineTag :ul_2>
    <:h2>System requirements – disk space
    <:p>A minimum of 1Gb free disk space is recommended.
    <:ul>around 250 MB for Java
    <:ul>around 12 MB for a fresh Tomcat Server installation
    <:ul>around 23 MB for KEY LOADING SERVER files
    <:ul>additional space for
    <:ul_2>Tomcat Server working files
    <:ul_2>KEY LOADING reports
    <:ul_2>log files (space depends on the trace level and clean up policies adopted)

  • Multiple Delimiters from a Text File

    I am having an issue trying to figure out how to seperate this text file into 4 columns so I can use the data,
    S, 0, { }, {a, d}
    a, 7, {S},
    b, 5, {a}, {c, h}
    c, 2, {b, d}, {f}
    d, 10, {S}, {c, e}
    e, 1, {d}, {f}
    f, 3, {c, e, h}, {g}
    g, 4, {f}, {F}
    h, 4, {b}, {f}
    F, 0, {g}, { }
    That is the the text file and i am trying to figure out how I could split the text file up in to four columns to manipulate the data

    The best starting point: What have you come up with so far, and what's wrong with it?

  • How Do You Write Thermocouple Readings From Multiple Channels to One Text File?

    Hi Everyone,
    I am having difficulty writing a Labview program that allows me to combine readings taken from 8 thermocouples to one text file. I am using a NI cDAQ - 9174 with NI 9219 modules.
    Attached is a copy of my program thus far. I have figured out how to combine readings from 8 thermocouples to one waveform chart but the text file will infact be more vital.
    I am very new to Labview and only require it for this task so the simpler the solution the better. Apologies for the lack of technical language.
    Any help would be much appreciated.
    Amy

    Here's one simple possibility...
    Of course, this shows incomplete file handling, and you'll probably want to truncate your floating point values to a few decimal places. I have used this kind of operations for generating text and csv files for thermocouples, much like you are doing.
    Good luck!
    Dan

  • Importing Tagged Text Files

    Working in MAC ID CS5 and pulling in text from a Windows based database that places tags automatically with the information it pulls.  Using <

    Shoot! Yes, I had typed in my code and it stopped at that.
    "Working in MAC ID CS5 and pulling in text from a Windows based database  that places tags automatically with the information it pulls.  Using Unicode tagging direct to TextEdit and saving as Unicode (UTF-16).  When placed in ID it either gives Boxes with x's in them, text only or response in below pic.  Is there a specific way to save, code or place that I am not seeing.  Where are the "rules" from ID on this.  We used Quark before and it was so simple.

  • Finding multiple strings in a text file and deleting the entire line

    Get-Content c:\output-Copy.txt | Where-Object {$_ -notmatch 'something1', 'something2', 'something3', 'something4' } | Set-Content temp.txt
    Above is the program that when it has 1 argument in the -notmatch part will find the specific string and delete the entire line. I need to be able to use multiple strings for my search, I am totally drawing a blank on this and I know its something REALLY
    simple but my brain is fried. The above code will work IF i only leave 'something1' and delete the rest. I need to find MULTIPLE matches and remove them all at once, what is a good way to accomplish this.

    You can use an alternating regex, like this:
    Get-Content c:\output-Copy.txt |
    Where-Object {$_ -notmatch 'something1|something2|something3|something4' } |
    Set-Content temp.txt
    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

  • Saving multiple records into text file

    Can I save multiple records into a text file at one go?
    My application has a list of data displayed there and when the user clicks on the save button it will save all the records on the screen.
    It works but it only saves the last record.
    Here are my codes
    // this is to display the list of data
    private JLabel[] subjects=new JLabel[20];
    private JLabel[] subTotal=new JLabel[20];
    private JLabel[] codes=new JLabel[20];
    private JLabel[] getTotal=new JLabel[20];
    String moduleCodes;
    String getPrice;
    double price;
    int noOfNotes;
    public testapp(Subjects[] subList)
    int j=0;
                double CalTotal=0;
              for (int i=0; i<subList.length; i++)
                   subjects[i] = new JLabel();
                   subTotal[i] = new JLabel();
                   codes=new JLabel();
                   getTotal[i]=new JLabel();
                   if (subList[i].isSelected)
                        System.out.println(i+"is selected");
                        subjects[i].setText(subList[i].title);
                        subjects[i].setBounds(30, 140 + (j*30), 400, 40);
                        subTotal[i].setText("$"+subList[i].price);
                        subTotal[i].setBounds(430,140+(j*30),100,40);
                        codes[i].setText(subList[i].code);
                        getTotal[i].setText(subList[i].price+"");
                        CalTotal+=subList[i].price;
                        contain.add(subjects[i]);
                        contain.add(subTotal[i]);
                        j++;
                        moduleCodes=codes[i].getText();                              
                        getPrice=getTotal[i].getText();
                        noOfNotes=1;
    // this is where the records are saved
         public void readRecords(String moduleCodes,String getPrice,int notes)throws IOException
              price=Double.parseDouble(getPrice);
              String outputFile = "testing.txt";
              FileOutputStream out = new FileOutputStream(outputFile, true);      
         PrintStream fileOutput = new PrintStream(out);
              SalesData[] sales=new SalesData[7];
              for(int i=0;i<sales.length ;i++)
                   sales[i]=new SalesData(moduleCodes,price,notes);
                   fileOutput.println(sales[i].getRecord());
              out.close();

    I suggest writing a method that takes a SalesData[]
    parameter and a filename. Example:
    public void writeRecords(SalesData[] data,
    String filename) throws IOException
    BufferedWriter out = new BufferedWriter(new
    FileWriter(filename, true));
    for (int i = 0; i < data.length; i++)
    out.write(data.getRecord());
    out.newLine();
    out.close();
    And it's good to get in the habit of doing things like closing resources in finally blocks.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Is there a way of addressign text files other than through the place command?

    I'm working with  a large document that has multiple  records - each record has 2  spreads of master pages - tha tis  1 spread and then another - so 4 master pages in all. I'm preparign individual tagged text files for each of these. I find it really onerous to  have to click on teh frame and "place" each individual text fiel. Is tehre not a way to invoke/import/place a text file that doesn't involve mousing around and  often clicking on teh wrong thing - thereby generatign a new frame and blowing everything to smithreeens?
    AS an aside - I've drawn the followign conclusions about workign with frames on master pages: when text is asked to flow form one  master spread onto anotehr - it won't work - CS4 crashes or simply doesn't  flow the text correclty - I've downloaded an excellent plugin from http://www.rorohiko.com/ called text stitch - that eanble stitchign of text frames  and htis seems ot work alhtough it still requires intervention of having to actualy click on teh   overflow red + indicator on teh last frame of the  spread generated by teh first  master pages and tehn clicking on the first frame of the 2nd  spread generated by the 2nd master.
    Also - what gives with questions aobut tagged text - I've noticed that 4 postings about this have gone unanswered - not jsut mine but others as well?
    Thanks for all your help - this forum is great!

    Also - what gives with questions aobut tagged text - I've noticed that 4 postings about this have gone unanswered - not jsut mine but others as well?
    I've been wondering that myself, but I've not had any answers for those posters. (I don't think that "Yeah, I used tagged text in Quark or PageMaker in the 90s, but these days anything that I would have wanted to do with tagged text would be easier to do with XML" would be very helpful.)

  • How I generate index markers using Applescript and tagged text!

    One of the challenges I've faced in automating the book making process using Applescript with inDesign is that there don't seem to be any AS commands for making new index markers (anyone please correct me I if I'm wrong about this).
    I've tried various js scripts which do an OK job, but they don't make the actual native markers. This means you have to wait until the book (consistiing of multiple ID files) is complete (so that all the page numbers have been established) to generate the index.
    Recently, I read a tweet from someone with a link to a technique which uses tagged text and find and replace with GREP to edit the tags, inserting the tagged text index tags in the text file and then re-placing the text file in the ID page. In itself, this works great. But I'm dealing with literally thousands of separate text frames, none of them connected in a story.
    The books typically consist of around 1200 pages with almost that many people, each of whose names I need to index with "Lastname, Firstname" references. And those particular strings don't (can't) appear anywhere on the pages. There will also be about 50 ID files all combined into one book. So it is imperative that I have ID generate the native index markers. To help keep things straight and efficient, I'm creating separate small text frames to hold the lastname, firstname strings. I created an object style for these frames which sets the attributes to "nonprinting", and I place the frames in the margin.
    Then I realized that I don't actually have to have ID export the tagged text files for each. I exported one prototype and copied its tags to properties in my script, and then I concatenate them with the respective list item values I import from the database.
    At the proper point in the page building script, I tell "textwrangleer" to make a new document, set its contents to the index string for the current record, save it to disk, overwriting the previous one, and then tell ID to "place" it in the index text frame, which generates the ID index mark.
    I actually got an AS error when I first tried this: "file doesn't exist" or some such. Then I realized that the "place" command was happening too soon, so I inserted a .5 sec delay in the script, and it worked.
    This is actually my first major script for actual work, and I'm so excited about it! I promises to cut production time down to about a thenth of what it was.
    I still have to add some logic to branch between handlers with slightly different parameters for five different page formats, but the same page building handler will work on all of them.

    A note on this:
    Daniel Swanson wrote:
    I've tried various js scripts which do an OK job, but they don't make the actual native markers. This means you have to wait until the book (consistiing of multiple ID files) is complete (so that all the page numbers have been established) to generate the index.
    These scripts typically search for words and immediately write out the page numbers they are found on -- one shot indexing.
    The solution is to add both the topic and its page reference to the current document's index:
    if (app.activeDocument.indexes.length == 0)
        app.activeDocument.indexes.add();
    app.activeDocument.indexes[0].topics.add(app.selection[0].contents).pageReferences.add(app.selection[0]);
    The first lines only make sure there is an index to add to (per default, a new document has none).
    The last line adds a selected word to the index (it must be a plain text string, hence the use of its 'contents'), and then adds a reference to the selection in the text itself.
    Adding the same word a second time will for a change (quite untypically for ID's Scripting) not result in an error but simply add another page reference to the existing one.
    When doing this in a loop: remember to work backwards, because the index marker itself gets inserted into the running text, and that will throw off your text indices.

  • Problems importing tagged text

    IDD CS5.5, 7.5.2
    what I do
    prepare IDD tagged text file, using DOS/Windows line ends and ANSII encoding
    open IDD CS5.5 file with formatted content
    select all content
    File > Place InDesign tagged text file, using "show list of problem tags" option
    what I get
    no angle brackets imported, no errors in the list of problem tags …
    74 paragraphs, all using the first paragraph style specified in the tagged text
    I wish IDD tagged text were as easy to get on with as FrameMaker's MML … that would also make it easier for me to start with one tagged source file and use the content in different applications with a minimum of effort. Any tips on _exactly_ what has to be done to placate the IDD Import goblins welcome!

    Give this script a try:
    // DESCRIPTION: This InDesign script reads the tags of an imported MML file and applies their corresponding paragraph styles.
    // USAGE: Place the MML file in InDesign. Using the Text tool, select all or part of the imported text. Run this script.
    var myDocument = app.activeDocument;
    if (app.documents.length != 0){
    //If the selection contains more than one item, the selection
    //is not text selected with the Type tool.
    if (app.selection.length == 1){
    //Evaluate the selection based on its type.
      switch (app.selection[0].constructor.name){
       case "Character":
       case "Word":
       case "TextStyleRange":
       case "Line":
       case "Paragraph":
       case "TextColumn":
       case "Text":
        convertMML(app.selection[0]);
       break;
       default:
        alert("Please select all or part of the text using the Text Tool.");
       break;
    } else {
      alert("No valid selection.");
    function convertMML(theSelection) {
    // this sequence collects the names of the paragraph styles in the MML file
    var theContent = theSelection.contents;
      var theParagraphs = theContent.split("\r");
      var theParagraphStyles = [];
      for (var i = 0; i < theParagraphs.length; i++) {
        if (theTag = theSelection.paragraphs[i].contents.match(/<!DefineTag (.+?)>/)) {
          theParagraphStyles.push(theTag[1]);
    // ********* this sequence adds dummy paragraph styles in the document, if necessary
    for (var i = 0; i < theParagraphStyles.length; i++) {
      var currentStyle = theParagraphStyles[i];
            try { myDocument.paragraphStyles.add({ name: currentStyle }) } catch(err){};
    // ********* This sequence set the preferences of the Grep queries
    app.findChangeGrepOptions.includeFootnotes = true;
    app.findChangeGrepOptions.includeHiddenLayers = false;
    app.findChangeGrepOptions.includeLockedLayersForFind = false;
    app.findChangeGrepOptions.includeLockedStoriesForFind = true;
    app.findChangeGrepOptions.includeMasterPages = true;
    app.findGrepPreferences = NothingEnum.nothing;
    app.changeGrepPreferences = NothingEnum.nothing;
    // ********* The action begins here
    // ********* This sequence removes spaces and/or TABs in the beginning of the lines
    app.findGrepPreferences.findWhat = '^\\s+';
    app.changeGrepPreferences.changeTo = '';
    myDocument.changeGrep();
    // ********* This sequence consolidates multiple paragraph returns into one
    app.findGrepPreferences.findWhat = '\\r\\r+';
    app.changeGrepPreferences.changeTo = '\\r';
    myDocument.changeGrep();
    // ********* This sequence removes the header and the paragraph declarations
    app.findGrepPreferences.findWhat = '((^<MML>\\r)|(^<!DefineTag .+?>\\r))';
    app.changeGrepPreferences.changeTo = '';
    myDocument.changeGrep();
    // ********* Now that everything is cleared up and in place, we can make the required changes
    for (var i = 0; i < theParagraphStyles.length; i++) {
      app.findGrepPreferences = NothingEnum.nothing;
      app.changeGrepPreferences = NothingEnum.nothing;
      var currentStyle = theParagraphStyles[i];
      var theGrepString = '^<' + currentStyle + '>';
      app.findGrepPreferences.findWhat = theGrepString;
      app.changeGrepPreferences.appliedParagraphStyle = myDocument.paragraphStyles.itemByName(currentStyle);
      myDocument.changeGrep();
      app.findGrepPreferences = NothingEnum.nothing;
      app.changeGrepPreferences = NothingEnum.nothing;
      app.findGrepPreferences.findWhat = theGrepString;
      app.changeGrepPreferences.changeTo = '';
      myDocument.changeGrep();
    It worked in your sample. To install it, select the text between the multi-hyphens lines, copy it to a text editor, save it with the ".js" or ".jsx" extension and put it on your Scripts Panel folder.
    To run it, place the MML in InDesign as unformatted text, select everything with the Text tool and double click the script in the Scripts panel. All the tags will be eliminated and the paragraphs will be formatted according with the MML tags. Be aware that this script doesn't contemplate character styles and any other formatting; only paragraph tags, like your sample.
    Hope it helps.

Maybe you are looking for

  • Short dump while reconstructing request in ODS

    Hi I had loaded a request into a few ODS, but later found i had to do some changes to the PSA manually, so i deleted the request from all the ODS and modified the records in the PSA. Now when i try reconstruction it gives a short dump in one of the O

  • Not able run the report in PDF format

    hi I'm using Report Builder 9.0.4.0.33 (10g). I'm able to generate salry slip for 1 emplyee,2 or 3 in pdf format but when it is more than 1000, in pdf format only it gives following error REP-1922: Internal error REP-50125: Caught exception: java.io.

  • Guest ssid with anchor controller and Web policy

    We have a WLC4404 and and anchor controller WLC4402 to provide guest access to the wifi net. We configured both in the same mobility group, and the guest ssid to attach to the mobility anchor 4402. All is working fine until we enable the web policy a

  • Youtube "This video is currently unavailable" in Safari 6.0.1

    So I've had this problem for a few weeks now and it's been driving me up the wall, but after fruitless internet searches in an attempt to solve it I've finally decided to submit a support ticket. This seems to be a widespread issue, but on my iMac ru

  • CS3 Design View And Invisible Elements

    Hello, CS3 Dreamweaver often doesn't shown hidden divs. I have an absolutely positioned div and it seems the only way to see it in design view is to go to code view select the div and switch back to design view and with luck it will appear. View - Vi