Article View: adobe.scripting.indesign
Article #93Re: script for a newspaper
From: jongware
Date: Mon, 30 Mar 2009 09:04
Date: Mon, 30 Mar 2009 09:04
25 lines
1937 bytes
1937 bytes
What a fun challenge! This one took me about 3 minutes -- but it was a mental exercise. Put your text cursor in a line and double-click this script: while (app.activeDocument.selection[0].paragraphs[0].lines.length < 2) app.activeDocument.selection[0].paragraphs[0].pointSize += 1; lowerguess = app.activeDocument.selection[0].paragraphs[0].pointSize; while (app.activeDocument.selection[0].paragraphs[0].lines.length < 3) app.activeDocument.selection[0].paragraphs[0].pointSize += 1; higherguess = app.activeDocument.selection[0].paragraphs[0].pointSize; app.activeDocument.selection[0].paragraphs[0].pointSize = (lowerguess+higherguess)/2; while (app.activeDocument.selection[0].paragraphs[0].lines.length > 2) app.activeDocument.selection[0].paragraphs[0].pointSize -= 1; It first enlarges the text up to a minimum required size to make the text 2 lines. I thought that a bit ... too easy -- you'll mostly end up with a single word on the 2nd line. So, next it enlarges the text up to 3 lines. It then takes the average of the two. If it ends up being 3 lines after all (I guess that's possible), the text gets smaller again to fit. (Don't use it on a single word! I just did -- it still works, but ... it will never get to 2 lines. Ever.)
Technical Details
Message-ID:
<59b872c6.0@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!newshub.sdsu.edu!webcrossingReferences:
<59b872c6.-1@webcrossing.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,f42a86f1bfc1c4a8 X-Google-Attributes: gidf939a,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: jongware@adobeforums.com Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!newshub.sdsu.edu!webcrossing Newsgroups: adobe.scripting.indesign Subject: Re: script for a newspaper Message-ID: <59b872c6.0@webcrossing.la2eafNXanI> Date: Mon, 30 Mar 2009 02:04:50 -0700 References: <59b872c6.-1@webcrossing.la2eafNXanI> Lines: 32 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit