🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #18988

Re: 'Merge Cells' syntax? [AS]

#18988
From: Shane Stanley
Date: Wed, 12 Feb 2003 10:17
32 lines
1835 bytes
in article 1de7c2b3.-1@WebX.la2eafNXanI, Aaron Andrade wrote:

> Hi, I'm trying to automate the merging of pairs of cells in a table. Here's
> the structure:
> 
> - given 2 adjacent selected rows...
> - tell the first cell of row 1 to merge with the cell below it (1st cell of
> row 2)
> - continue until all pairs are merged.
> 
> My table has 10 columns, so I would start with a selection of 20 cells, and
> end up with 10 cells.
> 
> I'm stuck on the 'merge' syntax, for which i can't find any examples anywhere!
> Although i did get a successful merge by selecting 2 cells and, in
> ScriptMaker, telling the selection to "merge".

Try this:

tell application "InDesign 2.0.2"
 set theCells to cells of selection
 set cellCount to count of theCells
 set theStart to index of cell 1 of selection
 set i to 1
 set n to cellCount / 2
 repeat with i from 1 to cellCount / 2
  merge item i of theCells with item (i + n) of theCells
 end repeat
end tell

-- 
Shane Stanley,  sstanley@myriad-com.com.au
Technical Details
Message-ID: <BA706A4D.4D82F%sstanley@myriad-com.com.au>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX
References: <1de7c2b3.-1@WebX.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,ce63d1ebeef2ab79
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2003-02-12 02:38:07 PST
From: Shane Stanley <sstanley@myriad-com.com.au>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: Re: 'Merge Cells' syntax? [AS]
Message-ID: <BA706A4D.4D82F%sstanley@myriad-com.com.au>
Date: Wed, 12 Feb 2003 02:17:02 -0800
References: <1de7c2b3.-1@WebX.la2eafNXanI>
Lines: 37
User-Agent: Microsoft-Outlook-Express-Macintosh-Edition/5.0.6
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit