Publi-Script Forums

Applescript / Javascript => Quark XPress scripting => Topic started by: AutoFetishist on March 05, 2012, 07:53:00 AM

Title: Box overflow
Post by: AutoFetishist on March 05, 2012, 07:53:00 AM
I use this code
         set boxList to object reference of every text box of every page whose box overflows is true

to alert the user before printing that a box exists with the overset indicator.

What I'm finding is that about 2/3 of the time the flagged boxes don't actually have any "real" text, maybe just a stray ∂ or →

I'm curious what anyone else would do to tell the script to ignore such instances (to me, they are harmless, not worth worrying about).

And too many false positives will defeat the purpose of having the script run.
(I'm already getting complaints from co-workers  ;)
Title: Re: Box overflow
Post by: Jean-Marie Schwartz on March 05, 2012, 08:00:29 AM
So what? Youíd like not to take into account boxes whose overflow is letís say empty? Canít you elaborate a list of everything that is not really text overflow (such as empty paragraph returns and so on) and just tell in the script if the overflowing text is in the list, just skip the alert? Donít know if Iím clear.
Title: Re: Box overflow
Post by: AutoFetishist on March 05, 2012, 03:03:44 PM
I understand your thought, but not sure how to code it.

How would one reference the text which has "overflown"?

Once I've done that, would I simply state

      if the number of characters in x (the overflow) is greater than 0, then...

or did you mean to approach it a diff. way?

Title: Re: Box overflow
Post by: Jean-Marie Schwartz on March 06, 2012, 03:29:30 AM
Oh! sorry! Since Iíve never worked with text overflow I thought it was possible and easy to know what was overflowingÖ
So what you could do is to check box overflows and when a box does overflow check the last char: if itís a carriage return or a tab or whatever would be assimilated to an empty char, just delete it and loop till the last char is not in the list youíve set. Does it make sense?
Title: Re: Box overflow
Post by: AutoFetishist on March 06, 2012, 07:12:27 AM
Aha.

This will be trickier then. Because for QXP, overflow is a property of text boxes, not stories.

Here's my full script:

set theSound to file ":Users:mainuser:Library:Sounds:copcar.wav" as alias


tell application "Play Sound"
     activate
end tell

tell application "QuarkXPress"
     tell document 1
          try
               set boxList to object reference of every text box of every page whose box overflows is true
          on error
               set boxList to {}
          end try
          if boxList's length > 0 then
               select (first item of boxList)
               show selection
               tell application "Play Sound"
                    play theSound
               end tell
          else
               display dialog "You're Clean, Baby"
          end if
     end tell
end tell


So, in the line

               select (first item of boxList)

I will need to have QX refer to the last character of that first item's story, right?

Because characters are not properties of text boxes... or are they?
Title: Re: Box overflow
Post by: Jean-Marie Schwartz on March 06, 2012, 07:29:31 AM
I guess looping through boxes in the list, youíll have to address the story 1 each time and check wether the last char is a paragraph return or whatever and delete it if not necessary (so this is another repeat loop inside of the first one), sth like if last character of story 1 of text box i is return then delete last character of story 1 of text box i (repeat while last character is not a full stop or any punctuation sign that might end a paragraph). I donít think itís a big deal when story 1 must be invoked instead of the text box itself. Whatís more complicate is when you must target the container. At least to meÖ
Title: Re: Box overflow
Post by: cdms on March 08, 2012, 03:10:00 AM
It may be easier to have two loops;

1. every story and tidy up the end as JMS suggests.
2. every overflow and check as you are currently

This should be easier than trying to do it nested.
Title: Re: Box overflow
Post by: Nerek on April 23, 2013, 08:30:07 AM
Nice script, i use it to control before printing.
I tried to adapt it to control overflow on table box but it seems that this property is usable only with text box. Any idea ?
Title: Re: Box overflow
Post by: Jean-Marie Schwartz on April 23, 2013, 09:18:26 AM
Have you tried targetting text cells?
Title: Re: Box overflow
Post by: AutoFetishist on April 23, 2013, 11:00:36 AM
Hello every-body

No, I remember wanting to, but it seemed table cells were their own animal.
Title: Re: Box overflow
Post by: Publi-Script on June 29, 2013, 11:13:42 AM
While non printing characters may be of no consequence when printing, the overflow indicator is there to tell you that not all the intended text fits in the marked text box. I really do not think it is wise to disregard the marker on the simple fact that they have no impact on your prints. The next time you will open that document, you will again see the overflow marker and wonder again if it is a "valid" one (as per YOUR explanation) or not.

I tend to solve these problems DEFINITEVELY in my documents, that way, anybody opening the document will not wonder if its good or not (the guy at the print shop comes to mind). You may as well have proof read the whole doc and determined that all overflow markers have no bearing on the final output and sent the doc to the print shop for output. The problem that may arise is that the print shop uses a slightly diffferent font than your which makes your text overflows even more. The print guy calls you stated that your have text overflowing and you tell him: "Go ahaead, it's ok". You see where I am going with this... You chose to disregard a marker that is designed to help you because you did not want to take the time to fix a flawed layout to begin with all the while causing a potentially very costly mistake.

My solution here would be to loop through all overflowing boxes and delete the last "non printing" character and repeat while the box is overflowing. Something like:

Quote
001   property nonPrintingCharList : {return, space, tab}

002   tell application "QuarkXPress"
003      activate
004      tell document 1
005         try
006            set otbList to object reference of every text box whose box overflows is true
007            repeat with otb in otbList
008               tell otb
009                  repeat while box overflows is true
010                     if last character of story 1 is in nonPrintingCharList then
011                        delete character -1 of story 1
012                     else
013                        exit repeat
014                     end if
015                  end repeat
016               end tell
017            end repeat
018         end try
     
019         try
020            set otbListFinal to object reference of every text box whose box overflows is true
021            set trueCount to count of otbListFinal
022            set ReportString to "ERROR: There is(are) " & trueCount & " overflowing boxe(s) in this document"
023         on error
024            set ReportString to "PASSED: There are no overflowing boxes in this document"
025         end try
     
026         beep 3
027         display dialog ReportString buttons {"OK"} default button 1 with icon caution with title "Overflow Box Test"
     
028      end tell
029   end tell
Note:
ē The line numbers included with this script are there to aid future discussions. In order to use this script, you will have to strip all of them.


Hope this helps!
Title: Re: Box overflow
Post by: AutoFetishist on June 29, 2013, 11:51:49 AM
Michel, I agree, absolutely. If one makes a habit of ignoring warnings, they lose their utility.

Good to see you back, by the way.
Do you think QX has a chance, now that Adobe is showing its true nature (requiring monthly subscriptions)?

Perhaps people will abandon InDesign?
Title: Re: Box overflow
Post by: Jean-Marie Schwartz on July 01, 2013, 02:18:52 AM
Hi Michel! Good to read from you again!  :)

Thanks for your script. Just wondering why you do not simply go to Utilities > Text Overflow  :)
Well I know, your script brings up that little thing that automates the deletion of unnecessary chars + one can somehow insert it in a much complex script.

Are you still working or playing with AppleScript and Quark? Or was it more to give us a sign you're still alive?  :D
Title: Re: Box overflow
Post by: Publi-Script on July 02, 2013, 02:31:52 PM
Hi Jean-Marie,

I went the "script" way because that is what the OP wanted...

And to answer your other question, my last "steady" work with Quark was with Q7. I am no longer in the prepress business although I still take on some contracts from home (mostly scripting contracts)
Title: Re: Box overflow
Post by: Jean-Marie Schwartz on July 03, 2013, 02:30:22 AM
I went the "script" way because that is what the OP wanted...
Oops! I'm so sorry! Totally forgot an OP should even exist  ::)
And to answer your other question, my last "steady" work with Quark was with Q7. I am no longer in the prepress business although I still take on some contracts from home (mostly scripting contracts)
OK, I knew you left the prepress biz. Glad to see you keep on scripting!  :)