Re: Indesign CS overriding master page items
Re: Indesign CS overriding master page items
- Subject: Re: Indesign CS overriding master page items
- From: Shane Stanley <email@hidden>
- Date: Tue, 25 May 2004 08:50:34 +1000
On May 25, 2004, at 4:19 AM, Sprague, Graham wrote:
How come every time I try to use the override command I get "<insert
any
object here> doesn't understand the override message".
You're not setting the target of the command properly. But you probably
knew that already.
I am pretty good with
Applescript but I cannot seem to make anything happen with Indesign. I
am
doing something very wrong. I am so not getting this. Here's some
sample
code that assumes you have created a page that has a master applied to
it
and now you would like to override any master page items whose labels
contain the word "Text". Any help would be great.
One unfortunate decision in ID CS was the use of the term "master page
items". In version 2, there was such a thing as a "master page item",
and therefore "master page items" was its plural. The whole thing has
been rearranged (for the better) in CS, but unfortunately the term
"master page items" has been retained, this time being a *property*
that returns a list of the page items a page has on its master page.
So...
set theItems to 0
tell application "InDesign CS"
tell document 1
tell page 1
set theItems to count of items of master page items
repeat with x from 1 to theItems
if (label of (item x of master page items) contains "Text") then
override page item (x) of master page items destination page page 1
Because master page items returns a list, you can only extract an item
from it by using "item x of ...", not "page item x of...". (And you're
calling the property repeatedly; better to do so once, and store it.)
But you're going about this the hard way. Your quest, in English, was:
'you have created a page that has a master applied to it and now you
would like to override any master page items whose labels contain the
word "Text"'. Translated to AppleScript, that becomes:
tell application "InDesign CS"
tell document 1
try
override (every item of master page items of page 1 whose label
contains "Text") destination page page 1
on error
-- none found
end try
end tell
end tell
--
Shane Stanley <email@hidden>
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.