Article View: adobe.scripting.indesign
Article #14708Rounding UP doesn't seem to work???
From: Casey D'Andrea
Date: Sun, 18 Jan 2004 06:41
Date: Sun, 18 Jan 2004 06:41
26 lines
3087 bytes
3087 bytes
I've been pulling snippets of scripts from this forum and the InDesign Scripting forum over at Adobe. I've made some tweaks, but I'm getting frustrated with the section where the script defines how many pages to create based on the number of frames needed divided by the number of frames per page. An excerpt of the particular defined variables: set myNumberOfFrames to (count of items of myFiles) --->36 set myNumberOfRows to 4 set myNumberOfColumns to 4 set myFramesPerPage to (myNumberOfRows * myNumberOfColumns) --->16 set myNumberOfPages to round (myNumberOfFrames / myFramesPerPage) rounding up --->36/16=2.25 --->2 For example, I have a folder of 36 images. The script is instructed to draw a 4 x 4 grid of frames per page which would mean I need 3 pages, 16+16+4. Well, whenround is used with rounding up it returns the values 2 instead of 3. I've read in a few other posts about some handlers written by one, Nigel Garvey. They allow you round up numbers instead of to the nearest whole number within 0.5. I'm scraping by here and I'm not sure how to introduce these into the script. I'd rather not be required to add extra scripting additions to user workstations. How do these handlers work exactly. Of note, if I simply add + 1 it will work, but it will work for all cases including returned values that actually round up. As a result I'll end up with an extra page. On the other hand if I don't add + 1, then the script will error out when it tries to draw a frame on a page that doesn't exist. set myNumberOfPages to round ((myNumberOfFrames / myFramesPerPage) + 1) rounding up --->36/16+1=3.25 --->3 I thought that maybe I could have the script look at the first digit after the decimal and if it's not zero (0) then to add an extra page. Anyone have a quick snippet for that one. I'd appreciate any help on this. I'm somewhat desperate as the folks I work with are constantly complaining about things they can no longer do in OS X. In OS 9 we had a script that ran with Quark and a Cumulus database that grabbed all the selected items in Cumulus and built a nice little report. Now that we're in OS X running InDesign CS, and the original developers of the Cumulus > Quark Catalog are no longer available I'm having to tackle this. Building the report from files in the Finder is my first step. After I get that working, with help from yourselves, I'll hopefully be able to integrate the Cumulus part of it.
Technical Details
Message-ID:
<2ccf6e6c.-1@webx.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!webxShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,516fe897c96e5a69,start X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2004-01-17 23:07:32 PST From: "Casey D'Andrea" <kcjones76@cogeco.ca> Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!webx Newsgroups: adobe.scripting.indesign Subject: Rounding UP doesn't seem to work??? Message-ID: <2ccf6e6c.-1@webx.la2eafNXanI> Date: Sat, 17 Jan 2004 22:41:15 -0800 Lines: 54 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit