Article View: adobe.scripting.indesign
Article #16835[VB] Positioning problem
From: Alex Bu
Date: Thu, 31 Jul 2003 04:31
Date: Thu, 31 Jul 2003 04:31
27 lines
2189 bytes
2189 bytes
Hi!
Hope you can help an absolute programming newbie. Here's what I want to do: I've got a table and a rectangle left of it. Now there's an object that should be placed horizontally in the center of the rectangle and vertically on the baseline of the currently selected textline in the table. Here's my vbscript so far:
Dim MyIndesign
Dim myLibrary
Dim myAsset
Set myIndesign = CreateObject("InDesign.Application.2.0")
Set myDocument = myIndesign.ActiveDocument
Set mySelection = myInDesign.Selection
Set myTextLine = myInDesign.Selection.Item(1)
myInDesign.Selection = nothing
Set myLibrary = myInDesign.Open("c:\myLibrary.indl")
Set myAsset = myLibrary.Assets.Item("AM")
myAsset.Place myDocument
Set myPlacedAsset = myInDesign.Selection.Item(1)
myPlacedAsset.Move Array(myTextline.HorizontalOffset - 17.15, myTextLine.Baseline - 3.3)
As you can see the asset "AM" is placed. Then I move it based on the baseline (ok, with a little offeset) and on the horizontaloffset of the current textmarker(?) position. See that "17.15"? That's the center of the rectangle mentioned above. The problem here is, i don't know how to figure out the position of the rectangle to place my object. Since I use the selection for the y positioning I can't use it to get the the value from the rectangle. To put it another way, I have no idea how to get the position from the rectangle without seleting it.
Hope you understand my problem and excuse my messy and yet unflexible code. Thanks in advance!
Alex
Technical Details
Message-ID:
<1dea239d.-1@WebX.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-08!supernews.com!news-out.visi.com!petbe.visi.com!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebXShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,29dc4ffd33a03c3d,start X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-07-30 21:37:44 PST From: "Alex Bu" <12three@gmx.de> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-08!supernews.com!news-out.visi.com!petbe.visi.com!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: [VB] Positioning problem Message-ID: <1dea239d.-1@WebX.la2eafNXanI> Date: Wed, 30 Jul 2003 21:31:13 -0700 Lines: 40 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit