1 Reply Latest reply on Dec 20, 2010 1:19 PM by [Jongware]

    [JS CS3] How to detect text flow?

    Tom Tomasko Level 1



      Here is a fun problem: I have a series of scripts that checks for various errors in formatting of an ID file. The errors are tagged with XML tags. Very nicely, none of the scripts change the text, just record the errors. This includes that the scripts do not create any text flow, for instance, pushing words from the bottom of one page on to the top of the next page. However, once in a while I have discovered that the text does flow. I do not think the problem is in the scripts but in some instability in the file. Most of the time there is no flow.


      So, I would like to write a script that detects text flow. I do not expect anyone here to write it for me but I would like suggestions on the following scheme or if anyone has a better road to follow.


      1. Upon opening a file, a script would record the number of characters in the last text frame of any multi-text frame story. This would establish the original state of the file. Getting the number of characters in the last frame is easy, but the thing to ponder is how to record? A .txt document could be created that contains that information, but then how do I use it? Perhaps better is to record the info in variables written by the script itself.


      2. Anytime that the number of characters in the last text frame changes an alert would pop-up stating this. Perhaps a snippet of the first line of the last frame would be included in the alert to help the user find the problem (there could be several multi-frame stories in the document).


      I would like to be able to turn on and off the alert. While editing there will be of course text flow. But while merely checking I do not want text flow but do want to know when it inadvertently occurs.


      I know that such a script(s) would involve Event Listeners, something I have not used before.


      Any suggestions? I'm just looking for pointers before I start on the road of writing this.





        • 1. Re: [JS CS3] How to detect text flow?
          [Jongware] Most Valuable Participant

          Yeah, I know what you mean. The "invisible" XML markers aren't exactly perfectly invisible -- perhaps they mess with the n-th digit of precision when justifying text, or something like that.


          There still may be a minor flow between two successive text frames -- a single word that suddenly jumps to the next page, but paragraph spacing adjusts itself to keep the same number of lines.


          A good idea, though. You could look into storing the number of characters per frame into the frame itself, as a custom label.