Article View: adobe.scripting.indesign
Article #14844Make tabs on left side of even pages, right side of odd pages
From: McKinley_Media
Date: Wed, 14 Jan 2004 00:04
Date: Wed, 14 Jan 2004 00:04
84 lines
2968 bytes
2968 bytes
Sorry for the newbie questions....
I'm having trouble checking for whether a page is odd or even, then creating a text box in the proper place. I end up with the program asssuming every page is even and creating a text box based on a two-page spread instead of the referenced page.
I'm just going to go ahead and post this whole mess in hopes you guys can help. Here's what I have:
tell application "InDesign CS"
set myTotalVert to ""
set myFirstVert to ""
set myLastVert to ""
set myLastCounty to ""
set myFirstCounty to ""
set myDoc to active document
tell myDoc
try
set mytabsLayer to make layer with properties {name:"Tabs", layer color:red}
end try
end tell
-- Page Loop
repeat with P from 1 to (the number of pages in myDoc)
if myLastCounty is not equal to "" then
set myFirstCounty to myLastCounty
end if
set myLastCounty to ""
set find preferences to nothing
set change preferences to nothing
set myPstyle to paragraph style "CountyTab" of myDoc
tell myDoc
set theResult to search (every item of all page items of page P whose class is text frame) with find attributes {applied paragraph style:myPstyle}
end tell
if P is 1 then
set myFirstCounty to first item of theResult
end if
repeat with i from 1 to (number of characters in myFirstCounty)
set myFirstVert to myFirstVert & mid(myFirstCounty, i, 1) & "^p"
end repeat
tell page P of myDoc
set myTabFrame to make text frame
set text of myTabFrame to myTotalVert
end tell
if (count of items of theResult) > 0 then
set myLastCounty to last item of theResult
repeat with i from 1 to (number of characters in myLastCounty)
set myLastVert to myLastVert & mid(myLastCounty, i, 1) & "^p"
end repeat
set myTotalVert to myFirstVert & "
C
O
U
N
T
Y
to
" & myLastVert & "
C
O
U
N
T
Y"
else
set myTotalVert to myFirstVert & "
C
O
U
N
T
Y"
end if
if P is odd then
tell page P of myDoc
set geometric bounds of myTabFrame to {".375i", ".08i", "10.625i", ".375i"}
end tell
else
tell page P of myDoc
set geometric bounds of myTabFrame to {".375i", "8.1i", "10.625i", "8.375i"}
end tell
end if
set applied paragraph style of text of myTabFrame to myPstyle
end repeat
end tell
Technical Details
Message-ID:
<2ccf5b36.-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,87266c627ec0d22b,start X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2004-01-13 16:07:49 PST From: McKinley_Media@adobeforums.com 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: Make tabs on left side of even pages, right side of odd pages Message-ID: <2ccf5b36.-1@webx.la2eafNXanI> Date: Tue, 13 Jan 2004 16:04:50 -0800 Lines: 93 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit