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.

Similar Messages

  • 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

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

  • Suppressing progress dialog when importing Tagged Text?

    Howdy:
    I'm using the Adobe Tagged Text import provider to place text in a document. I'm making the call to iImportProvider->ImportThis() with the kSuppressUI flag set. Even though the flag is set, InDesign is still displaying the progress dialog. Does anybody know how to keep that from happening? I don't see anything in the documentation about this.
    Thanks,
    Noel Williams

    Hello:
    I have the same problem that Noel.
    I'm using:
    * prov->ImportThis(database, stream, kSuppressUI, &contentUIDRef);
    * prov->ImportThis(database, stream, K2::kSuppressUI, &contentUIDRef);
    * prov->ImportThis(database, stream, (K2::UIFlags)0, &contentUIDRef);
    But the progress Dialog appears.
    This problem is critical for me.

  • Import tagged text without overwriting formatting?

    When processing an INDD file in InDesign Server CS5, we are importing text that contains Tagged Text tags.  The tags are being properly applied, but we are having an issue with the formatting in the INDD file being overwritten.
    For example: We have a selection of text that is formatted using a specific font type in the INDD file.  The tagged text being imported only has tags that defines the size of the font.  When the selection of text is replaced with the tagged text, the font type is replaced with the default font, rather than leaving it as it was even though we never defined the font type in the tagged text. 
    Any ideas on how we can apply tagged text but still retain any text formatting that was not specifically defined in the tagged text?
    Thanks!

    I am using
    InterfacePtr<IK2ServiceProvider> service(registry->QueryServiceProviderByClassID( kImportProviderService, kTaggedTextImportFilterBoss));

  • Problems importing Hebrew text

    I cut and pasted Hebrew text into MS Word from a Hebrew Word Processing Program (Davka 6). I then imported the text from Word into ID CS4 Standered. In about every third word a vowel sign under a letter dissappeared and was replaced with a box in middle of the word. I tried cutting and pasting from MS Word and got the same result. Does anyone have any suggestions for me? Switching fonts doesn't help. (The font I used is DavidD) Thank you!
    Bubby Bella

    The only thing that got displaced was the hyphens in the text which 
    turned into superscripts.
    That would be correct. They are called "makaf"s. The correct position 
    for hyphens (makafim) in Hebrew is at the x-height.
    Harbs
    http://www.in-tools.com
    Innovations in Automation

  • Trouble when importing tagged text (CS6)

    I'm trying to import a tagged .txt file into InDesign however when I do, the paragraph styles are not recognized and I end up with unformatted text. Is there a certain format the .txt file needs to be in (unicode 8, 16 etc.)? Any help would be appreciated, thank you!

    Tagged with InDesign Paragraph Style tags. I think I sorted it out, I needed to append the .txt file with "-mac.txt"

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

  • Tagged text import issues

    I have had some issues with importing tagged text. In my workflow i get some data converted to tagged text, no problems, special characters are also converted to ASCII entities.
    Everything works on my machine, but as soon as it is imported on another machine, the special characters are gone.
    I have located the issue, that my entities are lowercase (e.g. ë = <0x00eb>), and by making it uppercase (<0x00EB>) it works.
    What can be the difference on the machines? Is it an InDesign thing, or is it a CPU thing? The only difference on the machines are that mine is a Mac with intel processor, and the other is a G5.

    Oops -- the smiley face in the code should be changed to semicolon close angle (greater than sign). Jim

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

  • Importing URLs using tagged text

    I'm trying to import tagged text with URLs into InDesign. InDesign sees the links, but does not seem to know that the links are URLs (rather than text anchors or page links). I have nearly 1500 hyperlinked pieces of text I want to import, so I can't manually create Destination Definitions for all of them. When I try to send definitions in using tagged text, InDesign (CS2) crashes. Any help very much appreciated.

    There are many ways of "tagging" information in an InDesign document. For what you're doing, I'd suggest a unique paragraph style used only for this purpose, then you can search for text in it and use the contents.
    Dave

  • Accented characters in tagged text

    I normally write copy in a text editor (TextPad), paste into InDesign, and format in the Story Editor. Now I want to format in TextPad and import tagged text. But I am finding that accented characters from the numeric keypad as well as other more frequently used characters - €, £ - are being misinterpreted. For instance R$8·25 million (about €3 million) comes in as R$8·25 million (about €3 million) and  Fundação de Amparo à Pesquisa do Estado de São Paulo is rendered as Fundação de Amparo à Pesquisa do Estado de São Paulo.
    I have the options to format the text file as ANSI or DOS, and I have used the headers <ASCII-WIN> and <ANSI-WIN>, but there seems to be no combination that brings the text in cleanly.
    Substituting Unicode values for these characters gives me what I want and I can build a library of them to add in TextPad, but this is counter to my aim of more productivity.
    Can anyone give me a the formatting options to enable me to use the numeric keypad to generate the extended character set in a form that will import as tagged text?
    k

    Yes, sorry, it had to be somewhere from InDesign to InDesign. What I actually meant was that your tagged text started life in InDesign. My tagged text is starting life in TextPad.
    TextPad can save text in DOS (I guess that means ASCII), ANSI and UTF-8. It's possible that the text in the file I was importing wasn't actually in ANSI. I've restructured it now and it is importing accented characters correctly except, bizarrely, for the Euro symbol (yes, there is a € in the font - Myriad Pro). If I use Alt0128 to create the symbol - or the keyboard AltGr4 - import stops at the last complete line before the € would be encountered, and nothing more is imported. If I use <0x20AC> the symbol imports properly and the whole file is placed.
    I also worked with two identical (except for the substitution of some Unicode characters) versions of the same file. Both were ANSI, and both were headed with <ANSI-WIN> and no other definition information. One file picked up the definitions from the InDesign decument and rendered correctly, the other ignored all the paragraph styles and simply imported text at the default paragraph style.
    So please accept some points for your collection Ken for leading me to re-check the actual code set in the document.
    If you have any ideas about the € problem or why one version of the file would not pick up style definitions I would be intrigued to hear.
    k
    As an afterthought, I've attached a chunk of each file to show one that picks up definitions and one that doesn't. My initial thought was that the one that does pick up definitions would bleat about them being missing, while the other wouldn't. But if I place them in a blank file, both complain that the definitions are missing. However, If I make an appropriately named definition to match one in the file, the version that picks up definitions will match it and only bleat about the other missing definitions. The file that isn't picking up definitions will fail to honour the paragraph style, and will complain that the remainder are missing.

  • 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

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

  • CS3/JS: Code to import x-tagged text into Indesign

    Hi All,
    Normally we import text as X-Tag using Em Software plugin manually. We developed a script for auto-pagination in Indesign. But we couldn't find any JS code to import X-tagged text anywhere. So we used word file to import but facing lot of issues while importing word file into Indesign.
    Is there any javascript code to import text with X-tag plugin? If so, kindly provide. It will be be helpful for us very much.
    Thanks in advance.
    regards
    Masthan

    An external plugin can only (*) be used in Javascript if the original programmers added support for it. Best is to check its documentation, and if it's not mentioned in there, contact the authors.
    (*) Perhaps you can locate its menu entries and use those instead. I wouldn't know at all if that works with external plugins.

Maybe you are looking for