CS5 hangs with smart text reflow during scripting

Hello,
I have a batch script that opens each input file in a folder one after another and saves them as indd and pdf.
Now I have run across a problem.
The script opens the input document (a special xml format for our plugin, this opens one InDesign template and places some content into a specific text frame), then run preflight to check if there are overflows etc. and then saves the content to indd and pdf.
The input template has smart text reflow enabled, with adding new pages at the end of the document and deleting empty pages because I do not know how much content will be placed.
I have some strange issues:
In ID CS4, the script runs fine, but some times I got preflight errors for some documents (different ones on each run). If I open the documents afterwards, it seems the smart text reflow did not run before the script saved the indd (and so preflight found an text overflow).
However in CS5, InDesign hangs at some time during the script - windows task manager says it is not responding. This happens at a random file (not the same each time), the first ones before came out as expected.
Because of the preflight issues in CS4 I have made a test and created a new template with disabled smart text reflow and already added the maximum number of pages for my content. Now the script runs fine in CS5 (without hanging). But this way I have emtpy pages I do not want.
My assumption is, that the smart text reflow does run some sort of asyncronous and gets in the way of saving/exporting to pdf the file. A "$.sleep(5000);" after opening/placing does not help either.
Is there any way in scripting to force the smart text reflow or to wait for it until it is finished?
Below is the relevant part of the script.
Has anybody a solution or workaround?
Best regards,
Ingo
// process documents
for(var i = 0; i < alldocs.length; i++ ){
  try{
    // Opens document
    // this is a format that triggers our plugin which opens a specific indt-template and places the content
    var currentDocument = app.open( alldocs[i],true);
    // try to force document to be really ready - TODO: is there a better/working way? Some way to wait for smart text reflow?
    currentDocument.recompose();
    //$.sleep(5000); //Fallback - sleep for a reasonable time to let the document be opened - does not help either
    // process the document with the selected profile
    var process = app.preflightProcesses.add(currentDocument, Settings.preflightProfile);
    process.waitForProcess();
    // get the results
    var preflightResults = process.aggregatedResults;
    // each report is in the [2]-Array. First condition prevents NullPointer-Errors
    if((preflightResults.length > 0) && (preflightResults[2].length>0)){
      logLine(alldocs[i].name + ': Preflight problems');
    // save as InDesign
    var indesignFile = new File(Settings.outputDir.fullName+'/'+alldocs[i].name.replace(RegExp( '\.[^\.]{1,4}$' ), '.indd' ));
    currentDocument.save( indesignFile );
    // Export as PDF
    var pdfFile = new File(Settings.outputDir.fullName+ '/'+alldocs[i].name.replace(RegExp( '\.[^\.]{1,4}$' ), '.pdf' ));
    currentDocument.exportFile(ExportFormat.pdfType, pdfFile , false);
    currentDocument.close();
  catch(err){
    // if there was a problem, note filename to display later
    logLine( alldocs[i].name + ': Errormessage was "' + err.description + '"');

Well.. it works. It's a ugly cludge, but at least it works. I'm posting a snippet of code, because i'we seen a lot of threads on the same subject, and maby someone else will find it usefull.
// save old recompose and set new one
      var myOldSmartText = app.activeDocument.textPreferences.smartTextReflow;
      app.activeDocument.textPreferences.smartTextReflow = true;
      app.activeDocument.textPreferences.addPages = AddPageOptions.END_OF_STORY;
      app.activeDocument.textPreferences.deleteEmptyPages = true;
      //find docType headers and apply keep
      app.findTextPreferences = app.changeTextPreferences = NothingEnum.NOTHING;
      app.findTextPreferences.findWhat = "<docType:TaggedRTF>";
      app.changeTextPreferences.startParagraph = StartParagraph.NEXT_ODD_PAGE;
      myStory.changeText();
      //fix tables
      if (myStory.tables.length) {
/* long code to process tables, not interesting
     //process style rules
/* long code to preformat text, add/remove space after headings, lists, blocks etc.
      // save old preflight options, add new ones
      var oldPreflight = app.activeDocument.preflightOptions.properties;
      app.activeDocument.preflightOptions.preflightOff = false;
     // wait a maximum of 40 second for the preflight process. Before it runs, the (not so)Smart  Text Reflow should kick into action.
      app.activeDocument.activeProcess.waitForProcess(40);
      //stop preflight for a bit more performance?
      app.activeDocument.preflightOptions.preflightOff = true;
      //now check if story overflows? (maby you have a very large cell in a table? some wierd keep options? bad things happen
Can i mark my own answer as correct?

Similar Messages

  • How to Embed a Text Frame Within a Text Frame with Smart Text Reflow

    This is driving me nuts, and I've wasted hours searching exhaustively but can't seem to find the answer.
    I've been working with this indesign file and cleaning it up really well.  I now have all the text flowing with smart text reflow.  There are two parts in the book that have columns of information, or tables.  The way it was originally done was having a text box placed inside the text box.  But unfortunately, whenever you add pages before or after, the text box won't follow with the text box it is inside.  I have tried grouping the two text boxes together, but this doesn't seem to work with Smart Text Reflow (since every page is based on the primary master). How do you embed a text frame inside another text frame that is based off the primary master?  I guess it would be like using the text frame as an object. 
    I included an image to help my explanation.
    I even tried adding columns and then spannign the header part across, but this still doesn't flow with the rest of the text.

    ANchor it into the other text fram, look in the help file. Keyword = Anchored Objects.

  • Adding pages and Text Frames to emulate the behaviour of "Smart Text Reflow"

    I am creating a large number of tables in a document.  If I have Smart Text reflow turned on, my script does not work properly.  I have the start of the processing:
    1. Add a new table
    2. If the last page text frame overflows then Add a new page
    With smartTextReflow turned off, I want to ensure that new text frames that match the primary text frames from the master page.  It has to be able to handle getting the parameters from the left/right page text frame.

    I have been able to solve my problem.  I was really overthinking things!!!
    Since I have designated the text frames on the master pages as primary text frames, when creating a new page, a text frame is created automatically. So the problem is then just link the previous text frame to the text frame that was created when adding the page.
    TableAutomation.prototype.AddPage = function() {
         var previousTextFrame = app.activeDocument.pages[-2].textFrames[0];
         var np = app.activeDocument.pages.add();
         var textFrame = np.textFrames[0];
         previousTextFrame.nextTextFrame = textFrame;
    The cost of the above code was about 5 hours of banging my head against the wall

  • Fresh installed arch hanged with Skype in wmii during video call.

    Fresh installed arch hanged with Skype in wmi during video call. The keyboard stopped reacting to any keys, including Ctrl+Alt+F1 (F2, F3, F4, F5, F6), Ctrl+Alt+Backspace.
    The timer was actually working but updating in 3-5 seconds. While I had powerful laptop (i5 2.6GHz, 8Gb RAM). So,... I had to use power button to restart.
    Any ideas how to avoid this in future?
    Dis anybody experience similar issue?

    try webcam scharing had 20 scharing on there and wibe them out
    and myn works again

  • Indesign CS5 hangs when resizing text box

    I have looked at 20 pages of discussion and not found an answer.
    Every time I resize a text box Indesign will hang. It's a 380 page book, not every text box but some and the problem includes adding or deleting lines to make text move to a different page. Of course, the text is imported from a word doc.
    I have done all the usual stuff, checked and removed fonts, deleting preferences and cashes, exporting as an interchange doc and reopening. Nothing works.

    First, thanks to all who responded to my problem. My first time using the forums.
    It seems the footnotes are the problem causing ID to hang when text is reflowed.
    I have published longer books with longer text threads with no problem, but that was with CS1 and no footnotes. I upgraded to CS5 in December.
    Previous books have had footnotes at the end, which makes them endnotes I guess, but for this book the client wanted footnotes on the bottom of the page on which they occur.
    I broke the thread and I'm replacing the text boxes two pages at a time. Format them like I want, than place two more. This way all text which is reflowed is hidden and not really reflowed. After several hours and almost a hundred pages, no hangs or spinning beach balls.
    My system is a 24" iMac with OSX 10.6.6 and 4 GBs of RAM.
    I've not worked with cross references and it sounds like I don't want to.
    Once again, thanks!

  • Problem with oracle text indexes during import

    We have a 9.2.0.6 database using oracle text features on a server with windows 2000 5.00.2195 SP4.
    We need to export its data ( user ARIANE only ) and then import the result into another 9.2.0.6 database.
    The import never comes to an end.
    The only way to make it work is to use the "indexes=n" clause.
    Then ( without the indexes ), we tried to create manually the oracle text indexes.
    We get this error :
    CREATE INDEX ARIANE.DOSTEXTE_DTTEXTE_CTXIDX ON ARIANE.DOSTEXTE (DTTEXTE)
    INDEXTYPE IS CTXSYS.CONTEXT PARAMETERS('lexer ariane_lexer stoplist ctxsys.default_stoplist storage ariane_storage');
    ORA-29855: erreur d'exécution de la routine ODCIINDEXCREATE
    ORA-20000: Erreur Oracle Text :
    DRG-10700: préférence inexistante : ariane_lexer
    ORA-06512: à "CTXSYS.DRUE", ligne 157
    ORA-06512: à "CTXSYS.TEXTINDEXMETHODS", ligne 219
    We then tried to uninstall Oracle text and install it ( My Oracle Support [ID 275689.1] ). The index creation above still fails.
    We also checked our Text installation and setup through My Oracle Support FAQ ( ID 153264.1 ) and everything seems ok.
    Do we have to create some ARIANE* lexer preferences through specific pl/sql ( ctx_report* ? ) before importing anything from the ARIANE user ?
    What do we need to do exactly when exporting data with oracle text features from one database to another given we used to restore the database through a copy of the entire windows files ?
    Is there a specific order to follow to succeed an import ?
    Thank you for your help.
    Jean-michel, Nemours, FRANCE

    Hi
    index preferences are not exported, ie ariane_lexer + ariane_storage, only the Text index metada, thus the DRG-10700 from index DDL on target/import DB.
    I recommend to use ctx_report.create_index_script on source/export DB, see Doc ID 189819.1 for details, export with indexes=N and then create text indexes manually after data import.
    -Edwin

  • Photoshop CS5 - Issues with 3D Text and Reppouse

    Recently, I downloaded Photoshop CS5. Whenever I try to transform normal text into 3D with the Reppouse feature, I this error:
    "Your 3D scene now exceeds the limits of lights and/or textures for the video card's hardware-accelerated 3D Rendering. As long as the limits are exceeding, 3D rendering will be done in software only, and some features (e.g. Reppouse) will be disabled."
    If anyone has tips or advice on this problem, please fill me in because I will be gradly appreciate it. Thank you.

    1. Yes, many Laptops  that have onboard video chipsets are not good enough.
    2. Yes, your card does support some OpenGL and in this case this error reveals your card  does not support the 2 default Lights that are generated whn creating a Repousse mesh.
    3. Repousse requires OpenGL, other 3d functionality dos not require OpenGL
    For more info > GPU and OpenGL Support in Photoshop CS5 and CS4
    http://kb2.adobe.com/cps/404/kb404898.html
    Hope this helps

  • I have problem with The text size during the last weeks.

    My IPad 2 is a little weird. During the last weeks it seems it works ok, and suddenly text size, icons size grow very big and it takes me ages to get my IPad back to its original size. Is this happening to anyone?

    Short of something that might be going on with the settings, have you tried a reset of the iPad?
    Reset the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the button.
    In the event that something wonky is going on with your settings you can try Settings>General>Reset>Reset all settings. No data will be lost but all settings will have to be entered again.

  • CS5 problem with static text in Index

    When I increased the font size in the paragraph style for my Index entries, the static text (See, See also, etc.) didn't increase to match it. How can I change the style of static text?

    If you go and check under your character styles you should have an option for the index cross reference. Set it to the same size as the rest of the text for your index.

  • Smart Text Problem

    Has anyone seen a problem with smart text being cut off before the end of the message. Basically the first part of the message looks fine then the second half just seems to be missing. I am running jes2005Q4 with all the latest patches and T patches as of 10/27. Does messaging even support the smart text format?

    bingo
    SMTP is RFC limited to lines of 1000 characters. If a client package is sending longer lines, that client package needs to be fixed.
    You can have the MTA "wrap" those lines, if you like. Add the keyword, "wrapsmtplonglines " doc, here:
    http://docs.sun.com/app/docs/doc/819-2651/6n4u5ce7p?a=view

  • Problem with smart guides in CS5 with converting type object to outlines.

    Hi There,
    I recently upgraded to Illustrator CS5, and am having some issues with the smart guides.  I create some type with the text tool, then convert that type object to outlines.  Now, when I want another graphical object to "snap" to any of the anchors of the outlined text graphic, the smart guides don't kick in!  The problem does not seem to occurr if I make a standard graphic with other tools, only when I create a graphic from a type object.  I need to be able to snap to graphical objects that are created via the convert type to outlines command.  Has anybody experienced this issue before?  It's kinda frustrating.
    The issue didn't seem to happen in CS3, and I've noticed the design of the smart guides is a bit different in the CS5 version as well.  Am I missing something?
    Any tips would be greatly appreciated.  Thanks!

    When you switched to CS5 did you turn on view >> snap to Point
    If your snapping tolernace is set to a small value, you may need to zoom in more to get snapping to work, or just increase the value. Also make sure you have the appropriate items checked (eg:Anchor Path Labels)
    Edit Preferences >> Smart Guides >> Snapping Tolerance

  • Fix for CS5 & CS6 Hangs with Flashback Virus??

    I recently found that my imac was infected with the Flashback Virus.
    Ever since then, both CS5 and CS6 hang when trying to open them from Lightroom 4 or 3 using 'edit in.'
    This is isolated to my imac since Lightroom 3 & 4 work as expected with CS5 & 6 with my macbook.
    I have an appt with the Geniuses at the Apple Store tomorrow to delete the virus (Norton can identify it, but can't delete it.  So what are they good for?).
    My questions are:
    1.  Should I ask the experts at Apple to do anything in particular that can affect this problem, or
    2. Will a simple 'uninstall'/'reinstall' for LR and CS5 & 6 be sufficient?
    Recommendations from the Adobe experts will be greatly appreciated.
    Chris Bernhardt

    Oh well, the story continues (after I confirmed that CS5 works as expected after an 'uninstall/reinstall').
    I deleted the CS6beta and then reinstalled it.
    I then tried launching it from LR4 and CS6 hangs. 
    I then tried is from LR3 and CS6 works.
    I then loaded LR4.1 and tried to launch it (all by itself) and LR4.1 hangs (never finishes loading the last photo viewed prior to quitting LR4).
    I then deleted LR4.1 and reloaded LR4.0.
    LR4.0 launched and it successfully launched CS5.
    My conclusion - on my system there are two problems - one where LR4.1hangs and then another where CS6 hangs when trying to launch from LR4.0.
    So for now, I'll continue to use LR4.0 and CS5.
    I hope this helps with the development of LR4.1 and CS6.
    I'll post this separately so it comes to the attention of other members of the Adobe team
    Chris

  • Use smart mailbox to find email with specific text in attached pdf

    Does anyone known if a smart mailbox can be created to find emails with specific text within a pdf attached document. I know that spotlight can do this and it works fine but it would suite me better to be able to do this in mail.

    After some digging, I found that Spotlight returns the pdf attachment (found within the library/mail/download folder), but not the actual email. The only time it returns the email is if the search text or numerics are coincidentally within the written contents or subject line.
    Yes, i have tried setting up smart mailbox search criteria using the entire message contents but this does not find emails where the text exist within the pdf.
    I've checked spotlight pref.'s and all categories are checked off.
    Essentally, i need the smartbox search criteria to return results where the search text is found within the pdf attachment if possible. If this is not possible, i'll continue using spotlight searches outside of mail.
    I appreciate any help you can offer.

  • Need help with cleening text during ExportAllStories (JS-CS4)

    I have altered the ExportAllStories.jsx script for CS4 to export the selected TextFrame(s).
    The main function are the same as in the original.
    It works fine, but I need advice on how to clean the text before it gets exported to a text file.
    I have tried to pass the TextFrame object myStory, as in the original script, to a function like this:
    myStory = cleantext(myStory)
    The function cleantext works with a text string passed to it,like this:
    function cleantext(s) {
    s.replace(/\u2011/g,'-');
    I guess I have to extract the myStory object to a text string but haven’t succeeded yet.
    Maybe the solution is to do some search and replace with GREP or other techniques?
    All tips on how to proceed would be appreciated.

    This is how i solved my problem.
    With the help from Peter Kahrels function
    function replace (f, r)
       app.findGrepPreferences.findWhat = f;
       app.changeGrepPreferences.changeTo =r;
       app.documents[0].changeGrep ()
    And in my script I could easily do this:
    app.findGrepPreferences = app.changeGrepPreferences = null;
    story = app.selection[0].parentStory;
    // Sample: Replace non-breaking hyphen (8209 -> \u2011) with a regular hyphen.
    replace("/\u2011/g",'-');
    app.findGrepPreferences = app.changeGrepPreferences = null;
    And thereafter proceeding with the exporting stuff.
    Thank you all contributors in this forum!

  • Smart text flow doesn't work in scripting

    This is getting to be really frusting. I have enabled smart text flow, it only works if I open the app and modify a textframe. It never works when I run it through a script????? How do I activate this stupid feature using a script?

    Hi,
    This works (for me):
    var document = app.activeDocument;
    var textFrame = document.textFrames.add();
    var page = document.pages.add();
    var nextTextFrame = page.textFrames.add();
    document.textPreferences.smartTextReflow = true;
    document.textPreferences.limitToMasterTextFrames = false;
    document.textPreferences.deleteEmptyPages = true;
    document.textPreferences.addPages = AddPageOptions.END_OF_DOCUMENT;
    textFrame.geometricBounds = [10, 10, 280, 200];
    nextTextFrame.geometricBounds = [10, 10, 280, 200];
    nextTextFrame.previousTextFrame = textFrame;
    for(var index = 0; index < 100; index++)
        textFrame.contents += "Hello InDesign World Hello InDesign World Hello InDesign World Hello InDesign World Hello InDesign World Hello InDesign World Hello InDesign World ";

Maybe you are looking for

  • LDAP + User maintenance

    Dear all, One of our outsource Basis consultant recommends to configure the As ABAP system to LDAP directory. When we configured LDAP, could we maintain the users in the transaction SU01? or SAP trusts the LDAP user management therefore the user cann

  • Work process in running status from Long time

    Hi all, In my production system Workprocess is in runnig staus almost from 44 hours. i tried to end session of user but it not ending. i tried  to kill work process from sm50  end work process and from os(unix) kill -9 pid every thing i tried but wor

  • How will i configure third party sales order

    pls tell me how will i configure for third party sales order

  • Iphoto 8.1.2 not responding

    iphoto 8.1.2. will not open anymore. everytime I open it, it freezes as soon as click on anything. I have relaunched, restarted and reported but no good. I have an imac with 10.5.8.

  • Running forex platform on parallels any info welcome

    I am a forex trader and need information on running windows based forex platform on a MacBook Air I have been using Wine however this is not that good. I am thinking Parallels looks better Please let me know if you have experience running Windows bas