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, when round 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.