πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #18884

Re: use master page

#18884
From: BATTISTELLI Laurent
Date: Mon, 17 Feb 2003 07:55
74 lines
3789 bytes
thnaks Ole ,

I will work on it !!



Olav Kvern a οΏ½crit:
> Laurent--
> 
> Sorry, I was going to post the thread containing my function here, but I'm having a hard time finding the thread. Here's the subroutine I was talking about:
> 
> 
> 
> Private Sub Command1_Click() 
> Dim myInDesign As InDesign.Application 
> Dim myMasterSpread As InDesign.MasterSpread 
> Dim myPage As InDesign.Page 
> Set myInDesign = CreateObject("InDesign.Application.2.0") 
> Set myDocument = myInDesign.Documents.Add 
> Set myMasterSpread = myDocument.MasterSpreads.Item("A-Master") 
> Rem Delete one of the master spread's pages 
> myMasterSpread.Pages.Item(1).Delete 
> Set myPage = myMasterSpread.Pages.Item(1) 
> Rem Add four random rectangles to the page. 
> myPageHeight = myDocument.DocumentPreferences.PageHeight 
> myPageWidth = myDocument.DocumentPreferences.PageWidth 
> For myCounter = 1 To 8 
>     myX1 = myPageWidth * Rnd 
>     myX2 = myPageWidth * Rnd 
>     myY1 = myPageHeight * Rnd 
>     myY2 = myPageHeight * Rnd 
>     Set myRectangle = myPage.Rectangles.Add 
>     myRectangle.GeometricBounds = Array(myY1, myX1, myY2, myX2) 
>     Rem Label and color one of the rectangles. 
>     If myCounter = 4 Then 
>         myRectangle.FillColor = myDocument.Swatches.Item("Black") 
>         myRectangle.Label = "Delete this one" 
>     End If 
> Next 
> Set myMasterSpread = myDocument.MasterSpreads.Add 
> myMasterSpread.Pages.Item(1).AppliedMaster = myDocument.MasterSpreads.Item("A-Master").Pages.Item(1)
> 
> Set myPage = myDocument.Pages.Item(1) 
> myPage.AppliedMaster = myMasterSpread
> 
> myIndex = myFindMasterItemByLabel(myPage.AppliedMaster, "Delete this one") 
> If myIndex = Empty Then 
>     myIndex = myFindMasterItemByLabel(myPage.AppliedMaster.AppliedMaster, "Delete this one") 
> End If 
> myPage.MasterPageItems.Item(myIndex).Delete 
> Rem Choose Remove All Local Overrides from the Pages palette menu to see 
> Rem the overridden rectangle reappear. 
> End Sub 
> Private Function myFindMasterItemByLabel(myMasterPage, myLabel) 
> For myCounter = 1 To myMasterPage.PageItems.Count 
>     If myMasterPage.PageItems.Item(myCounter).Label = myLabel Then 
>         Rem The index of the item is the count of the item from the end of the list, 
>         Rem because PageItems are arranged in back-to-front order. But the MasterPageItems 
>         Rem collection for a page is indexed in the opposite order. So we have to return 
>         Rem the index using the following technique: 
>         myFindMasterItemByLabel = (myMasterPage.PageItems.Count - myCounter) + 1 
>         Exit Function 
>     End If 
> Next 
> End Function 
> 
> 
> 
> 
> The above demonstrates finding a master page item by its label--you could use other attributes, such as color, page position, etc.
> 
> Thanks,
> 
> Ole
Technical Details
Message-ID: <3E509572.5050200@comidoc.fr>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!newsswitch.lcs.mit.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX
References: <3E4113E8.1060604@comidoc.fr> <1de7b559.7@WebX.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: f939a,ff1d5253cfa97279
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2003-02-17 00:10:07 PST
From: BATTISTELLI Laurent <l.battistelli@comidoc.fr>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!newsswitch.lcs.mit.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: Re: use master page
Message-ID: <3E509572.5050200@comidoc.fr>
Date: Sun, 16 Feb 2003 23:55:30 -0800
References: <3E4113E8.1060604@comidoc.fr> <1de7b559.7@WebX.la2eafNXanI>
Lines: 86
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; fr-FR; rv:1.0.2) Gecko/20021120 Netscape/7.01
X-Accept-Language: fr-fr, fr
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit