Article View: adobe.scripting.indesign
Article #15500AS - drawing a box on the active page?
From: Casey D'Andrea
Date: Sat, 06 Dec 2003 14:34
Date: Sat, 06 Dec 2003 14:34
31 lines
3643 bytes
3643 bytes
I made an earlier post about having difficulty with an older 2.0.2 script not working in CS. Well, I got it working and now I want to modify it's behaviour. I'm running a Cumulus client (in Classic) in OS 10.3.2. The general idea is that an asset or assets are selected from a collection within an open catalog. The script is triggered from the Special Scripts menu within Cumulus. The asset(s) is/are then placed into InDesign. Here's are the general working of the script: 1. It notes whether a collection is open and if any assets are selected and proceeds to define variables for theCollection and theAssets 2. It creates a new document in InDesign CS if one isn't open. It defines a few more variables that will be used further down the line i.e. active document, selection, count of selection. 3. It sets the units of measure to points while the script is running and then switches them back at the end of the script. As frames and coordinates are defined using this unit value. --- This is the part that I want to fix. Currently the script defines a variable for the page (cPageNum). The problem is that the script defines this as the total number of pages, so it draws the frame at the end of the document. I want the script to define the variable as the active/current page. Currently: set cPageNum to number of page of myDocument tell page cPageNum of myDocument set imageTop to item (3) of bounds set imageLeft to item (4) of bounds set imageTop to 0 set imageLeft to imageLeft + 10 end tell This defines the variables as the total number of pages and proceeds to draw the frame at the top of the page 10 points right of the page edge. If I'm working on page 2 of 3 I want it to draw the frame top right of page 2 (lefthand page where the asset would actually sit at the top left corner of page 3), not page 3 (righthand page where the asset would sit top right, just off onto the pasteboard). --- 4. After defining the location of the to-be-newly created frame, it does some more work in Cumulus to attain the record ID of the asset(s) selected and sets defines another variable (theFile) to be used in the next step. 5. Back in InDesign CS, it runs a couple nested if statements which determine whether or not it needs to draw a frame prior to placing theFile. In most cases, I will have a frame selected before running this script where the above isn't an issue, but otherwise if will create a new frame 10 points to the right of the top of the LAST PAGE (see issue above). 6. After all the assets are placed it returns to measurement units back to the original units. Anyone have the proper syntax to define the active page versus the total count of pages? I suppose ideally, I'd have the script determine if it was a left-facing page or a right-facing page and position the new frame just off onto the pasteboard of that page (just off to the left of a left-facing page, or just off to the right of a right-facing page. 99% of the time there will be no more than 2 page butting.
Technical Details
Message-ID:
<2ccec6d8.-1@webx.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!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,129671036175acbc,start X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-12-06 06:37:39 PST From: "Casey D'Andrea" <kcjones76@cogeco.ca> Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!webx Newsgroups: adobe.scripting.indesign Subject: AS - drawing a box on the active page? Message-ID: <2ccec6d8.-1@webx.la2eafNXanI> Date: Sat, 6 Dec 2003 06:34:09 -0800 Lines: 64 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit