Article View: adobe.scripting.indesign
Article #8860Re: Any ideas on how to get at the MasterPageItems?
From: Olav_Kvern
Date: Thu, 21 Sep 2006 20:43
Date: Thu, 21 Sep 2006 20:43
30 lines
2237 bytes
2237 bytes
Hi Steven,
First, why not just create a new frame with exactly the properties you want? In many ways, master page items are a user interface feature that scripters don't really need to bother with.
If, for whatever reason, you do decide to use master page items, it's not too difficult to do so. You can get at the master items for a particular document page using something like this:
Rem Where myPage is a document page.
myAppliedMasterSpread = myPage.AppliedMaster
If myAppliedMaster is not idNothingEnum.idNothing (which it'll be if the page has no applied master), you'll get a master spread object. The trick now is to find the master text frame you're looking for. You can find which of the master spread pages is applied to the document page using myPage.Side, and then get a reference to the corresponding master page in the master spread, and then find the master text frame on that page, but there's an easier way.
Use the Script Label palette to give the master text frames you want to use unique labels. Something like "VersoBodyText" or "RectoBodyText"--it doesn't really matter what it is, provided each frame has a unique label on the spread. Then use:
Rem Assuming you have a reference to master spread "myMasterSpread" and a reference to a document page "myPage"
Set myMasterFrame = myMasterSpread.TextFrames.Item("VersoBodyText")
If myMasterFrame.Count > 0 Then
Set myTextFrame = myMasterFrame.Item(1).Override(myPage)
End If
At this point, you can flow text into the overridden text frame on the document page.
Hope this makes sense!
Thanks,
Ole
Technical Details
Message-ID:
<3bc1baa8.0@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news.glorb.com!news.ecp.fr!news.germany.com!news.isoc.lu!webcrossingReferences:
<3bc1baa8.-1@webcrossing.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,48336fd92bbda446 X-Google-Attributes: gidf939a,public X-Google-Language: ENGLISH,ASCII-7-bit From: Olav_Kvern@adobeforums.com Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news.glorb.com!news.ecp.fr!news.germany.com!news.isoc.lu!webcrossing Newsgroups: adobe.scripting.indesign Subject: Re: Any ideas on how to get at the MasterPageItems? Message-ID: <3bc1baa8.0@webcrossing.la2eafNXanI> Date: Thu, 21 Sep 2006 13:43:36 -0700 References: <3bc1baa8.-1@webcrossing.la2eafNXanI> Lines: 39 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit