Article View: adobe.scripting.indesign
Article #17230Re: Layers and Textframes/Tables (VB)
From: Olav Kvern
Date: Wed, 25 Jun 2003 22:15
Date: Wed, 25 Jun 2003 22:15
32 lines
1923 bytes
1923 bytes
Hi Wolfgang--
We'll start with the last question first: to make a layer active, you set the ActiveLayer property of the ActiveWindow to a reference to that layer.
The ItemLayer property of a page item(like a text frame) controls the layer of the page item. The easiest way to make one layer have the same content as another is to duplciate each item, then set the ItemLayer property of the duplicated items to a reference to the layer you want to move them to.
Here's an example that demonstrates both answers:
Dim myInDesign As InDesign.Application
Set myInDesign = CreateObject("InDesign.Application.2.0")
Set myDocument = myInDesign.Documents.Add
Set myPage = myDocument.Pages.Item(1)
Set myTextFrame = myPage.TextFrames.Add
myTextFrame.GeometricBounds = Array("6p", "6p", "24p", "24p")
myTextFrame.ParentStory.Tables.Add
Set myDefaultLayer = myDocument.Layers.Item(1)
Set myNewLayer = myDocument.Layers.Add
Set myNewTextFrame = myTextFrame.Duplicate
myNewTextFrame.ItemLayer = myNewLayer
Rem Now make the new layer active
myInDesign.ActiveWindow.ActiveLayer = myNewLayer
Rem Hide the original layer
myDefaultLayer.Visible = False
Thanks,
Ole
Technical Details
Message-ID:
<1de9af58.0@WebX.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.news2me.com!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebXReferences:
<1de9af58.-1@WebX.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,aef012511300a9ca X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-06-25 15:37:48 PST From: "Olav Kvern" <okvern@adobe.com> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.news2me.com!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: Re: Layers and Textframes/Tables (VB) Message-ID: <1de9af58.0@WebX.la2eafNXanI> Date: Wed, 25 Jun 2003 15:15:17 -0700 References: <1de9af58.-1@WebX.la2eafNXanI> Lines: 34 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit