Article View: adobe.scripting.indesign
Article #16560AS: select page item problem
From: Pete Johnston
Date: Mon, 25 Aug 2003 18:03
Date: Mon, 25 Aug 2003 18:03
53 lines
2804 bytes
2804 bytes
Can someone help me figure out what I'm doing wrong here?
I'm writing a script to unimpose a vertically oriented booklet (a calendar, actually). The file has been set up with 11x17 page size and has been laid out with 8.5x11 pages imposed for the printer. The script is meant to produce reader's spreads that my clients can proof.
The script succeeds in testing page items for position (in order to select items on the top half of the page), but when it finds an item that is on the top half, I get an "invalid parameter" error on "select myitem with append selection." UNLESS the page being processed (page 2, since that's the first to be processed) is the active page.
If page 2 is the acttive page, then the script fails at the next step: pasting the items from the top half on page 15 (a blank page I've added at the end of the document). Instead of pasting onto page 15, it pastes the selection onto page 2 and then gets an error message that it "can't get selection of page 15."
I'm probably missing something obvious. Any help would be appreciated.
--Pete
script is below:
tell application "InDesign 2.0.1"
set myDocument to active document
repeat with i from 1 to 6
tell page (i * 2) of myDocument
repeat with myPageItemCounter from 1 to count page items
set myitem to page item myPageItemCounter
if item 3 of geometric bounds of myitem < 51.1 then
select myitem with append selection
end if
end repeat
cut
end tell
tell page 15 of myDocument
paste
move selection to {-1, -1}
end tell
tell page (i * 2 + 1) of myDocument
repeat with myPageItemCounter from 1 to count page items
set myitem to page item myPageItemCounter
if item 3 of geometric bounds of myitem < 51.1 then
select myitem with append selection
end if
end repeat
cut
end tell
tell page (i * 2) of myDocument
paste
move selection to {-1, -1}
end tell
tell page 15 of myDocument
select all page items
cut
end tell
tell page (i * 2 + 1) of myDocument
paste
move selection to {-1, -1}
end tell
end repeat
end tell
Technical Details
Message-ID:
<2ccd140f.-1@webx.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!nntp.infostrada.it!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,3c5fbe491133df98,start X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-08-25 11:08:05 PST From: "Pete Johnston" <pete@yearbox.com> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!webx Newsgroups: adobe.scripting.indesign Subject: AS: select page item problem Message-ID: <2ccd140f.-1@webx.la2eafNXanI> Date: Mon, 25 Aug 2003 11:03:35 -0700 Lines: 64 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit