Re: InDesign script Optimization and text frame threading
Re: InDesign script Optimization and text frame threading
- Subject: Re: InDesign script Optimization and text frame threading
- From: David Wolfe <email@hidden>
- Date: Wed, 15 Feb 2006 10:27:11 -0500
Hi Shane,
Looking at my original script, the 6th or 7th line addresses the view
preferences. We typically work in page origin, but I didn't want to
assume that that would always be the case. So I scripted the view
preference setting right from the start.
I think I've got a clue as to why the script isn't working. The
script runs fine if the first page is Recto, but gives the invalid
parameter error if the first page is Verso. I have to be able to use
the same script whether the document begins Verso or Recto, which is
why I wrote the original script I first quoted here addressing the
pages with variables and arrays
set myPages to get every page of every spread of active document
set Frame2 to (override selection destination page (item 2 of myPages))
I DID actually get the script to work all the way through on any
document, but I would still like to try to streamline the code using
a repeat if possible. As it stands, the script will do up to 22
pages. The working script as it now stands is:
tell application "InDesign CS"
set mydocument to active document
set myPSName to "PC-Photo credit bl.il"
set protoType to "«fields page, placement, credits" & return & "«If
Page = pageinfo(3)»«If prev page = pageinfo(3)»,
«endif»«placement»«credits»«repeat 50»«if next page is not pageinfo
(3)»" & return & "«endif»«end repeat»«endif»"
-- Setting Ruler Origin and Zero Point
set theOrigin to ruler origin of view preferences of mydocument
if theOrigin is not page origin then
set ruler origin of view preferences of mydocument to page origin
end if
--Set Zero Point of Ruler to Zero
set theRuler to zero point of mydocument
if theRuler is not {0, 0} then
set zero point of mydocument to {0, 0}
end if
--choose working layer & Master Page
set active layer of active window to layer "credits for PDF product
only" of active document
set layerName to "credits for PDF product only"
set myMasterPages to get every page of master spread "F-Slug" of
active document
set myPages to get every page of every spread of active document
--make creditFrame text boxes
--first verso . . .
tell item 1 of myMasterPages
set myCreditFrameVerso to make new text frame with properties
{content type:text type, geometric bounds:{63.75, 3.0, 64.25,
44.625}, label:"masterpageFrameVerso"}
end tell
tell active document
set theStyle to paragraph style "PC-Photo credit bl.il"
set myStory to parent story of myCreditFrameVerso
set applied paragraph style of myStory to theStyle
end tell
--then recto . . .
tell item 2 of myMasterPages
set myCreditFrameRecto to make new text frame with properties
{content type:text type, geometric bounds:{63.75, 6.375, 64.25,
48.0}, label:"masterpageFrameRecto"}
end tell
tell active document
set theStyle2 to paragraph style "PC-Photo credit bl.il"
set myStory2 to parent story of myCreditFrameRecto
set applied paragraph style of myStory2 to theStyle2
end tell
--override master page text boxes
select myCreditFrameVerso
try
set Frame1 to (override selection destination page (item 1 of
myPages))
set Frame3 to (override selection destination page (item 3 of
myPages))
set Frame5 to (override selection destination page (item 5 of
myPages))
set Frame7 to (override selection destination page (item 7 of
myPages))
set Frame9 to (override selection destination page (item 9 of
myPages))
set Frame11 to (override selection destination page (item 11 of
myPages))
set Frame13 to (override selection destination page (item 13 of
myPages))
set Frame15 to (override selection destination page (item 15 of
myPages))
set Frame17 to (override selection destination page (item 17 of
myPages))
set Frame19 to (override selection destination page (item 19 of
myPages))
set Frame21 to (override selection destination page (item 21 of
myPages))
end try
try
select myCreditFrameRecto
set Frame2 to (override selection destination page (item 2 of
myPages))
set Frame4 to (override selection destination page (item 4 of
myPages))
set Frame6 to (override selection destination page (item 6 of
myPages))
set Frame8 to (override selection destination page (item 8 of
myPages))
set Frame10 to (override selection destination page (item 10 of
myPages))
set Frame12 to (override selection destination page (item 12 of
myPages))
set Frame14 to (override selection destination page (item 14 of
myPages))
set Frame16 to (override selection destination page (item 16 of
myPages))
set Frame18 to (override selection destination page (item 18 of
myPages))
set Frame20 to (override selection destination page (item 20 of
myPages))
set Frame22 to (override selection destination page (item 22 of
myPages))
end try
--Link photo credit text frames
try
set properties of Frame1 to {next text frame:Frame2}
set properties of Frame2 to {next text frame:Frame3}
set properties of Frame3 to {next text frame:Frame4}
set properties of Frame4 to {next text frame:Frame5}
set properties of Frame5 to {next text frame:Frame6}
set properties of Frame6 to {next text frame:Frame7}
set properties of Frame7 to {next text frame:Frame8}
set properties of Frame8 to {next text frame:Frame9}
set properties of Frame9 to {next text frame:Frame10}
set properties of Frame10 to {next text frame:Frame11}
set properties of Frame11 to {next text frame:Frame12}
set properties of Frame12 to {next text frame:Frame13}
set properties of Frame13 to {next text frame:Frame14}
set properties of Frame14 to {next text frame:Frame15}
set properties of Frame15 to {next text frame:Frame16}
set properties of Frame16 to {next text frame:Frame17}
set properties of Frame17 to {next text frame:Frame18}
set properties of Frame18 to {next text frame:Frame19}
set properties of Frame19 to {next text frame:Frame20}
set properties of Frame20 to {next text frame:Frame21}
set properties of Frame21 to {next text frame:Frame22}
end try
--make inData Prototype for on-page photo credits
set pageOne to page 1 of active document
tell pageOne
set myPrototype to make new text frame with properties {content
type:text type, geometric bounds:{75, 1.59, 79, 23}, contents:protoType}
set myProtoText to parent story of myPrototype
set applied paragraph style of myProtoText to theStyle
end tell
--begin import of Photo Credit Data
set myCredits to parent story of Frame1
import data from file (choose file) using prototype story
myProtoText into story myCredits with showing dialog
end tell
I appreciate your (and everyone else on the list) feedback and help
with this.
David Wolfe
settingPace
On Feb 14, 2006, at 10:35 PM, Shane Stanley wrote:
Are your frames on the right master pages? As your code stands,
they won't
be if you have view preferences set to spread origin (the default).
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden