Article View: adobe.scripting.indesign
Article #19078Re: Scripts that fail from Palette
From: Dave Saunders
Date: Thu, 23 Jan 2003 13:03
Date: Thu, 23 Jan 2003 13:03
59 lines
3144 bytes
3144 bytes
Oh, sorry, I was in a hurry. That should have said
Split call n of row 3 of myTable using horizontal.
I'm sure that using vertical puts less strain on the system, but it's less useful!
Here's the script I ended up with. It starts by pulling a template table from the library. Because the straightforward way of just splitting the same row more than twice fails (even incrementing the row count so that you split the one that was just created fails in the same way, I restructured the script to use a library to reconstitute the table after every row split:
set myAsset to asset 1 of library "CA-Library" whose name is "TwoUpFeatTable"
set label of page 1 of document 1 to "Import table grabs template."
select nothing
place myAsset on document 1
set myTabInsert to item 1 of selection
set label of page 1 of document 1 to "Import table increase frame size."
set myBounds to visible bounds of myTabInsert
set item 3 of myBounds to ((item 3 of myBounds) + 20)
set visible bounds of myTabInsert to myBounds
set label of page 1 of document 1 to "Import table prepares rows."
set myTabStory to parent story of myTabInsert
set myTable to table 1 of myTabStory
if Tend - Tstart = 2 then
tell myTable to delete row 3
tell myTable to delete row 2
-- might need to fix the stroke in this case.
else if Tend - Tstart = 3 then
tell myTable to delete row 3
else if Tend - Tstart > 4 then
repeat
-- insert (Tend - Tstart - 4) duplicates of row 3 of table
repeat with x from 1 to count of columns of myTable
split cell x of row 3 of myTable using horizontal
end repeat
if (count of rows of myTable) = (Tend - Tstart) then
exit repeat
end if
set myAsset to store myTabInsert into library "CA-ClipLib"
delete myTabInsert
select nothing
place myAsset on document 1
delete myAsset
set myTabInsert to item 1 of selection
set label of page 1 of document 1 to "Import table reimorted table."
set myTabStory to parent story of myTabInsert
set myTable to table 1 of myTabStory
end repeat
end if
I'm using the label of page 1 as a kind of error reporting/diagnostic mechanism so that if any of my deep subroutines error me back to the control routine, it can check that to see what error occurred.
Dave
Technical Details
Message-ID:
<1de76d0e.9@WebX.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!opentransit.net!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!WebXReferences:
<1de76d0e.-1@WebX.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,50cdc56b84d3d053 X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-01-23 05:24:36 PST From: "Dave Saunders" <daves@pdsassoc.com> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!opentransit.net!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: Re: Scripts that fail from Palette Message-ID: <1de76d0e.9@WebX.la2eafNXanI> Date: Thu, 23 Jan 2003 05:03:03 -0800 References: <1de76d0e.-1@WebX.la2eafNXanI> Lines: 70 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit