Article View: adobe.scripting.indesign
Article #15446Re: JS: Copy/Paste
From: Peter_Kahrel
Date: Sat, 29 Nov 2003 12:07
Date: Sat, 29 Nov 2003 12:07
31 lines
2250 bytes
2250 bytes
Thanks for this, Dave, that sorted out a problem I had. I'm comfortable with JS, but ID's object model still buggers me from time to time. As you can't set preferences for tables in ID, I wanted a script to format an existing table (delete all rules, set all insets to zero, align all cells to leading, and set the space before and after the table to zero. Most worked fine with code like this (select all cells to make it work): _table = app.selection[0]; _table.topEdgeStrokeWeight=0; _table.topInset=0; _table.firstBaselineOffset=FirstBaseline.leadingOffset; (Some similar lines for right, bottom, and left omitted). But then the space before and after the table. This is where your example came in: _table = app.selection[0].parent.parent; _table.spaceBefore=0; _table.spaceAfter=0; B This works, but only if there's no selection. I then started figuring out how things went depending on how many parents you stick in the first line and what you select. This left me confused, but that may just mean that I still don't properly understand ID's object model. For example: _table = app.selection[0].parent; _table.spaceBefore=0; _table.spaceAfter=0; This works only if you have a selection of at least one cell. Another example: _table = app.selection[0].parent; _table.topEdgeStrokeWeight=0; _table.topInset=0; This works only if there's no selection. I'm still trying to figure out the interaction of selections and the number of parents, and how to decide when to use a parent node. But thanks anyway for pointing me in the right direction in this particular case. Peter
Technical Details
Message-ID:
<2cce9b87.2@webx.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!webxReferences:
<2cce9b87.-1@webx.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,a3cad43350bb7b3d X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-11-29 04:37:29 PST From: Peter_Kahrel@adobeforums.com Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!webx Newsgroups: adobe.scripting.indesign Subject: Re: JS: Copy/Paste Message-ID: <2cce9b87.2@webx.la2eafNXanI> Date: Sat, 29 Nov 2003 04:07:23 -0800 References: <2cce9b87.-1@webx.la2eafNXanI> Lines: 44 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit