Soft Returns in Tagged Text

Our Pindar AgilityCMS content managment system flows text to an InDesign page using a special PlugIn.
Some characters are stored natively (store an "a", get an "a" on the page), while other special characters are stored using Tagged Text or Unicode. A return can be either <0x000D> or \u000D. This is especially useful because we can output through one of four "channels".... InDesign, Quark, HTML or as entered in the content manager. The return can now be \p in Quark or <BR> in HTML.  A non-breaking space, for example, can be \u00A0 in the InDesign channel, &nbsp; in HTML or <\!s> in Quark. When we insert the "special character" in the Data Editor of our content system, it might be displayed as [sp], but it will resolve correctly regardless of which channel we publish to.
The problem is that unlike Quark, Adobe does not provide for a "soft return" or forced line break. Sure, you can type one from the keyboard with shift+return, and purists will argue that you'd never want to store a soft (discretionary) return in any type of tagged text or a content management system. However, all our text is set flush left, ragged right, and we frequently want to force line breaks for readability, and do so consistently.
Instead of:
On Sale Now Buy One, Get
One Free
we always want
On Sale Now
Buy One, Get One Free
Again, this is a problem whether you store your data in simple tagged text files, or if you bring it in via a complex PlugIn, as we do.
There are many, many threads on this site and elsewhere that discuss this shortcoming. Does Adobe plan to support Soft Returns in Tagged Text with some kind of special tag?

Your question is predicated on some false assumptions, and I'm afraid Peter, Peter, and Stix didn't quite pick that up in their replies. (This gives me pause since normally they're all very detail-oriented).
As I told you when you posted in the thread from 2009, "InDesign Tagged Text supports forced line breaks just fine."
You write:
Does Adobe plan to support Soft Returns in Tagged Text with some kind of special tag?
Adobe's import mechanism does indeed support soft returns. There's no need to speculate on Adobe's plans, which is the direction the other replies went to.
With that in mind, let's move to your actual question:
Our Pindar AgilityCMS content managment system flows text to an InDesign page using a special PlugIn. 
Some characters are stored natively (store an "a", get an "a" on the page), while other special characters are stored using Tagged Text or Unicode. A return can be either <0x000D> or \u000D. This is especially useful because we can output through one of four "channels".... InDesign, Quark, HTML or as entered in the content manager. The return can now be \p in Quark or <BR> in HTML.  A non-breaking space, for example, can be \u00A0 in the InDesign channel, &nbsp; in HTML or <\!s> in Quark. When we insert the "special character" in the Data Editor of our content system, it might be displayed as [sp], but it will resolve correctly regardless of which channel we publish to.
I think you need to address this question to your support channel for Pindar AgilityCMS. Indeed, in IDTT <000A> represents a shift-return. Here's a screenshot of a test textframe:
and when exported to InDesign Tagged Text, it produces:
<ASCII-MAC>
<Version:7><FeatureSet:InDesign-Roman><ColorTable:=<Black:COLOR:CMYK:Process:0,0,0,1>>
<DefineParaStyle:NormalParagraphStyle=<Nextstyle:NormalParagraphStyle>>
<ParaStyle:NormalParagraphStyle>Paragraph one
<ParaStyle:NormalParagraphStyle>Paragraph two<0x000A>P2/Line two
I presume you have tried <0x000A> as discussed in the prior thread.
I suppose it's remotely possible this is a Mac/PC issue, because the two operating systems do you different line break characters.
Anyhow, once again, your criticism of InDesign and Adobe is false and unfair. And if you have a problem with a 3rd party plugin, those are really the people you need to talk to.
Still, it might be wise to get it working with plain File > Place. Try testing my above IDTT file. Or exporting your own from a sample textframe like the one I used.

Similar Messages

  • 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

  • Tagged text export unicode

    hi,
    is there any possibility to set the ITaggedTextImportPreferences before exporting to a tagged text file with an IExportProvider?
    i need to export it in Unicode, but default is ASCII.
    best regards

    As far as I can tell, this isn't a new bug in as much as InDesign CS3, CS4, CS5 and CS5.5 (Mac) all exhibit the same problem exporting soft-returns in Unicode encoded Tagged Text where they are replaced with hard returns on import. Unfortunately it appears that we may be the only ones that care and thus it's unlikely that Adobe will fix it (unless someone adopts it as a JDI bug).
    Update: after testing some more it appears this is an export bug for Mac OS-only. In other words, if you use a PC to export a story that contains soft-returns to Tagged Text (Unicode), the soft-returns are preserved when placing into a document using a Mac. And vice-versa, using a Mac to export a story with soft-returns to Tagged Text (Unicode) and then placing this into a document using a PC exhibits the same substitition of soft-returns for hard-returns.
    Message was edited by: Caleb Clauset

  • Soft returns not importing

    Hi. I recently impoterd a Frame 7.1 Chapter into RoboHelp
    HTML 8.0 and everything worked okay with the exception of soft
    returns. For some reason it didn't import these and I was left with
    large strings of test which I had to fix by hand. Any ideas? Thanks
    in advance

    As far as I can tell, this isn't a new bug in as much as InDesign CS3, CS4, CS5 and CS5.5 (Mac) all exhibit the same problem exporting soft-returns in Unicode encoded Tagged Text where they are replaced with hard returns on import. Unfortunately it appears that we may be the only ones that care and thus it's unlikely that Adobe will fix it (unless someone adopts it as a JDI bug).
    Update: after testing some more it appears this is an export bug for Mac OS-only. In other words, if you use a PC to export a story that contains soft-returns to Tagged Text (Unicode), the soft-returns are preserved when placing into a document using a Mac. And vice-versa, using a Mac to export a story with soft-returns to Tagged Text (Unicode) and then placing this into a document using a PC exhibits the same substitition of soft-returns for hard-returns.
    Message was edited by: Caleb Clauset

  • Soft Return in Text Tool

    Hi all
    I've recently upgraded to CS3 from CS1 (yeah, I'm always late to the party), and the transition has been a lot easier than I expected. However there's one thing driving me nuts!
    When using the text tool in CS1, shift+enter would give you a new line within the existing paragraph (I believe it's called a soft return?), so it keeps the leading but doesn't add the "space after paragraph". In CS3 this doesn't work and it's really screwing with my ability to create decent web page mockups.
    I've searched all around here and across the web and not found any answers - perhaps I'm using the wrong terminology?? Anyway - any ideas?
    Thanks in anticipation! :)
    Ben

    Yes, that's exactly what I'm trying to use John (and that's what I'm used to in CS1).
    I'm on PS v10.0.1, if that helps anyone.
    Just checked and it works in Illustrator 10.0.2...
    In fact, I can copy the necessary text into Illustrator, do my soft returns, and then copy back into Photoshop and it's fine. It's a bit bloomin long-winded, but at least it's a workaround!!
    I'd love to hear if anyone else has encountered this? I wonder if it's a bug?

  • Soft Returns in SIte Editor?

    Hi,
    I'm having trouble creating a soft return in the site editor. I already adjusted the settings in the partner portal for this, but that only seems to be reflected when editing through the admin area. It's preferable for the client to do all the editing through the site editor. But when you try to create a soft return, it keeps creating a <p> tag, which makes it look a bit wonky.
    What am I missing with this?
    Any help would be appreciated, thanks!

    Hey Liam,
    Yeah, I know how to create a soft return.  It's just that its not working in the site editor. I hold shift and enter, yet it still creates a <p>. I was wondering if it was a system thing, or something that I wasn't doing correctly? The areas I'm trying to edit are just simple text, so I wasn't sure why it wasn't working.

  • Exporting Text as InDesign Tagged Text in CS3

    Hello All,
    I am facing a problem exporting the Text from InDesign Document as InDesign Tagged Text. It use to work properly in CS2. But in CS3 the IExportProvider interface CanExportThisFormat() always returns false for the format name "Indesign Tagged Text".
    InterfacePtr<IPMStream>filetream(StreamUtil::CreateFileStreamWriteLazy(sysfile));
    iiExportProvider->ExportToStream(filetream, doc, iselMgr, formatNameOfInterest, kSuppressUI);
    If the CanExportThisFormat() function is ignored and directly tried to export with the above ExportToStream() function it still fails to export into stream.
    Has the way to export the InDesign Tagged Text been changed in CS3.
    Can any one whos tried this please help as its urgent.
    Thank you in advance.
    Regards
    Farzana.

    Hi Vikas
    I export files from Photoshop as png's at 72 dpi.  
    Here is our current holding page.  http://www.iheartmylife.co.uk/ All the text on this page has been loaded in as png's from Photoshop along with the image. As you can see none of it is as sharp as it could be.
    Many thanks for your assistance.
    James

  • Tagged Text in InDesign 5.5

    I posted this in the general discussion and was pointed to scripting.
    I use tagged text in the files I place
    in InDesign. For example,
    <cn>This is the chapter number
    <ct>This is the chapter title
    <cst>This is the chapter subtitle
    <bt>This is the beginning of the body text
    <ah>This is an A-level head
                    and so on. In PageMaker, there was a checkbox in the "place"
    dialogue box named "Read tags." I checked that, and when I placed the file in the template (in which I had the styles defined), the whole chapter appeared with the formatting I wanted for each style. I could use anything I wanted for a text tag, as long as it was in <>. If it wasn't defined in the PM document, it came in in the basic style but could be formatted on the fly in PageMaker.
                    I can't find the equivalent checkbox in InDesign. I can't believe it is no longer there, but I can't find it. There is a lot online about exporting tagged text, but where, oh where, is my checkbox for placing tagged text? If someone knows where it is, I'd be very grateful. It seems that such a great (and incredibly easy) function shouldn't be gone.
    Thanks (and apologies to those who already saw this in the general discussion),

    Well, not quite four hours, but yes, I couldn’t get it to work. For one thing, I wasn’t sure about the header to use, since I’m on Windows. I used <ASCII-WIN>
    <Version:7><FeatureSet:InDesign-Roman>
    <pstyle:ah>
    <pstyle:ah_bib>
    <pstyle:bib>
    <pstyle:bh>
    <pstyle:bl>
    <pstyle:bl_ext>
    <pstyle:bt>
    <pstyle:bt_fl>
    <pstyle:cn>
    <pstyle:ct>
    <pstyle:cst>
    <pstyle:epi>
    <pstyle:epi_source>
    <pstyle:ext>
    <pstyle:ext_1stpara>
    <pstyle:ext_2dpara>
    <pstyle:fn>
    <pstyle:fn_2dpara>
    <pstyle:poem>
    <pstyle:poem_1st>
    <pstyle:poem_last>
    I added the above to one of my tagged text files and saved it from Word as .xml. When I brought it into InDesign, I got a sidebar with a couple of entries, one of which expanded to several “parts.” There was nothing in the template until I double clicked (I think that’s what I did; maybe right clicked) one of those sidebar items and placed the text. It came it as one long file with no returns and no formatting. The tags remained as text.
    I came back to the Internet and found an article by Peter Kahrel entitled “A GREP queries manager.” OK, I admit I didn’t understand much of it, but the notion of chaining queries sounds good.
    I did the Lynda.com tutorials when I was first ordered to make the change to InDesign (last month). I found them very helpful, but if they have anything on this, I missed it. Maybe I was too busy figuring out how to turn pages, find things on the pasteboard, and determine what character styles are and why I have to use them J
    “Not hard”? Um, what is the etiquette for asking you to do this task for me? I’m assuming that once I had a script in hand, I could add new paragraph styles by mimicking the entries. Is that right? Would it really be as easy as opening all the files and running the script to make the changes throughout? That sounds wonderful. Even running it on one at a time would be a great improvement. Do I need to contact you off list, and, if so, how?
    Thanks . . . yet again.

  • Soft returns in Pages for iPad

    I would really like to create a space between numbered items in Pages but I can't figure out how to do it.  Does anyone know how to create a soft return in Pages for iPad?
    I have seen responses for the desktop application but not the iPad application.

    Pages 1.7.1, IOS 5.1.1
    You start a bullet item and then press both ⇧ and return keypad keys to force a newline. This turns off the bullet style. Press return. Use the paintbrush toolbar icon to reselect the Bullet paragraph style again. This approach shows the inelegant possibility.
    The best approach would be at the end of your bullet text, change your line spacing from 1.0 to 1.25 from within the paintbrush > Layout tab. A return continues your bullet style. If your normal body text has been 1.0 line spacing, you can switch back to that after your list.

  • Selectively ignore Problem Tags Dialog  while importing Tagged Text in CS5.5

    Hi
    My script imports tagged text and places it in selected frames. Due to the tag creation process used, I occasionally get a "Ignoring character level attribute termination tag "<cTracking:>" found without the corresponding character level attribute application tag "<cTracking:value>"
    Since it's not a problem I can ignore this specific error -- but I don't want to turn off ALL problem tag error checking because occasionally there are serious errors that I DO want to see.
    Is there a way to tell ID to ignore this specific error?
    Thanks
    Akiva

    UNfortunately the original ascii files uses a <D> code to return to the default settings -- and since that occasionally includes resetting the tracking to 0 I need to include the "<cTracking:>" tag.
    I could obviously fix it by adding a "<cTracking:0>" to all the codes -- but that seems like it could cause more problems.
    I can preprocess the ascii code to eliminate the excess codes -- but that increases processing time for something which happens only occasionally and is non-problematis in practice.
    Akiva

  • 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

  • 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

  • [IDCS3 WIN] Assert while importing tagged text

    Hi,<br /><br />I use the following code to import a tagged text from a buffer into a text frame:<br /><br />IDataBase* database = frameUIDRef.GetDataBase();<br /><br />InterfacePtr<IHierarchy> frameHierarhy(frameUIDRef, UseDefaultIID());<br />int32 count = frameHierarhy->GetChildCount();<br /><br />InterfacePtr<IMultiColumnTextFrame> textFrame(frameHierarhy->QueryChild(0), UseDefaultIID());<br /><br />if( !textFrame )<br />return UIDRef::gNull;<br /><br />UID storyUID = textFrame->GetTextModelUID();<br /><br />InterfacePtr<ITextModel> textModel(database, storyUID, UseDefaultIID());<br /><br />if( !textModel )<br />return UIDRef::gNull;<br /><br />UIDRef result = UIDRef::gNull;<br />InterfacePtr<IK2ServiceRegistry> services(gSession, UseDefaultIID());<br />InterfacePtr<IK2ServiceProvider> service(services->QueryServiceProviderByClassID(kImportProviderService, kTaggedTextImportFilterBoss));<br />InterfacePtr<IImportProvider> prov(service, IID_IIMPORTPROVIDER);<br /><br />InterfacePtr<IPMStream> stream(StreamUtil::CreatePointerStreamRead(taggedtext, strlen(taggedtext)));<br /><br />if (prov->CanImportThisStream(stream) == IImportProvider::kFullImport)<br />{<br />database->BeginTransaction();<br /><br />prov->ImportThis(database, stream, K2::kSuppressUI, &result);  //This line generates the Assert<br /><br />if (result != nil )<br />{<br />Utils<ITextUtils> textUtils;<br />InterfacePtr<ICommand> moveAllStoryCommand(textUtils->QueryMoveStoryFromAllToAllCommand(result, ::GetUIDRef(textModel)));<br />CmdUtils::ProcessCommand(moveAllStoryCommand);<br />}<br />     <br />database->EndTransaction();<br />}<br /><br />It works fine, but when "ImportThis" is called i get this:<br /><br />ASSERT 'fCmdProcessorState == kDoing || fCmdProcessorState != kNotProcessing || cmdMgrRef.GetDataBase()->GetUndoSupport() == IDataBase::kNoUndoSupport' in ..\..\..\source\components\appframework\commandmgmt\CommandProcessor.cpp at line 2889 failed.<br /><br />Any help would be appreciated.<br />Thanks in advance, David

    I would say the problem here is in using database->BeginTransaction()/EndTransaction(). Basically you should never call these methods - you need to find/create a command to do the processing instead, then perhaps wrap the two commands in a command sequence.
    I know there was a post saying ' don't use those methods' a long time ago by Ken Sadahiro (then of Adobe) - you might find it with a search, though will have been archived by now.
    Ian

  • 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.

  • Need help with creating text anchors with tagged text.

    Can anyone tell me how to determine the correct value for a "Hyperlink Dest Index" value?
    I have a script which creates a tagged text file that specifies about about 280 pages of tables (thank heavens for autoflow) , and would like to add live links between different parts. I can create a text anchor and a hyperlink to it in InDesign. The tagged text definition for the link source is simple and in-line and exports and imports nicely as tagged text. However, I see that all the link destinations, aka  text anchors, are all exported at the very end of the tagged text files as global definitions, and thier location iin the document is specified by the property HyperlinkDestIndex. However, I can't figure out how to set this value progammatically. I've spent over an hour exporting links, and it sure isn't anything as obvious as character index in the story.
    Any advice appreciated,
      Read Roberts

    Read, I'm not sure the following is going to help you. It works for external hyperlinks, but you want internal links, right? Anyway, it might give you some clues.
    A funny thing: I was reviewing some script where I got links to work, and I spotted a tiny coding error. Links seemed to be defined by two separate identifiers: a "link name", which is what appears in Edit Hyperlink dialog, and a "Dest Key", which seems to be a simple increasing number. However, due to aformentioned coding error, the dest keys between the actual link and its definition were off by '1', so there was no way that ought to have matched. But it still worked! So "Dest Key" is a red herring ...
    As far as I understand, it works like this (for hyperlinks): in your text, you have
    HplName -- this is actually the 'title' that appears in the Hyperlink palette
    HplDest -- this is the 'internal name'
    DestKey. Hm. Perhaps you could omit this, per above obsvn.
    CharStyleRef, the name of the auto-applied style
    Hid -- seems to be always '0'
    HplOff: the "offset" from this entire command to the start of the hyperlink, in InDesign characters.
    HplLen: the "length" from the hyperlinked text, in InDesign characters.
    and in the list of 'proper' definitions, those that appear at the very end of your file:
    HplDestDfn -- the internal name again
    DestKey -- see above
    HplDestUrl -- finally! A real URL! (But you must escape lots of characters, such as the forward slash and colon.)
    Hid -- again, always seems to be '0'.
    Some of these items are perhaps optional, but experimenting with what may be left out only lead to frustration The Tagged Text guide is far from complete, as I'm sure you already knew.
    As noted, some (or all) of the named items need a backslash escape for a few characters, but I can't find a definitive way to determine in advance what is 'good' and what is 'not good'.
    The following script creates a Tagged Text file with a couple of working hyperlinks in it -- I don't know if this is of any help for your internal links.
    var hyperlinkDest = [];
    var text = "This is some text with a link [http://www.jongware.com/idjshelp.html] and another one [http://forums.adobe.com/thread/1014617?tstart=0] in it.";
    var tagtext = text.replace (/\[(.+?)\]/g, function (full, match)
                        return makelink (match, 'title:'+match, match, match);
    // When done processing plain text, add the destinations at the end:
    tagtext += hyperlinkDest.join('');
    tagFile = File(Folder.myDocuments+'/__tmp.txt');
    if (tagFile.open('w') == false)
              alert ("Unable to create temporary file!");
              exit();
    if (File.fs == "Windows")
              tagFile.write ("<ASCII-WIN>\n");
    else
              tagFile.write ("<ASCII-MAC>\n");
    tagFile.write ("<dcs:HYPERLINK=<cu:1>>\n");
              tagFile.write (tagtext);
    tagFile.close();
    // 'text' is the actual text that will be clickable
    // 'title' is what will appear in the Hyperlinks palette
    // 'name' is the internal name in the Edit Hyperlink dialog
    // 'url' is the actual URL that will be linked to
    function makelink (text, title, name, url)
              var destkey = hyperlinkDest.length;
              // In URL you must escape forward slashes and colons
              // .. and some other characters as well, by the way. There seems to be no list
              url = url.replace(/\//g, '\\/').replace(/:/g, '\\:');
              hyperlinkDest.push ('<HplDestDfn:=<HplDestName:'+name+'><DestKey:'+String(destkey)+'><HplDestUrl:'+url+'><Hid:0>>');
              return '<Hpl:=<HplName:'+title+'><HplDest:'+name+'><DestKey:'+String(destkey)+'><CharStyleRef:HYPERLINK><Hid:0><Brdrv:0><HplOff:0><HplLen:'+String(text.length)+'>>'+text;

Maybe you are looking for