Article View: adobe.scripting.indesign
Article #17134vertical gradients in multipage table?
From: Peter Hedrington
Date: Mon, 07 Jul 2003 19:42
Date: Mon, 07 Jul 2003 19:42
54 lines
3098 bytes
3098 bytes
I am trying to script adding a vertical gradient blend for each brand name
section in a InDesign table.
The table can run as long as 40 pages and there can be from two to ten brand names per page. The gradient colors alternate between two colors for each brand.
I have a script which will work on the first page but the cells see their
offset from the beginning of the chart not the page they are on. The gradient on the other hand needs its starting point set to the page it is on. So starting on the second page I get what appears to be a solid fill which is really the very bottom of the gradient.
Here is the script.
tell application "InDesign 2.0.2"
tell active document
set theFrame to object reference of selection
set theStory to parent story of theFrame
set theTable to table 1 of theStory
set rowCount to count of rows of theTable
set brandRows to {}
repeat with i from 1 to rowCount
set rowColor to name of fill color of row i of theTable
if rowColor = "SV Black" then
set brandRows to (brandRows & i)
end if
end repeat
set theGrad to "SV Gradient 1"
set brandRows to (brandRows & (rowCount + 1))
set brandCount to count of items of brandRows
repeat with i from 1 to (brandCount - 1)
set rangeStart to ((item i of brandRows) + 1)
set rangeEnd to ((item (i + 1) of brandRows) - 1)
set theStarts to height of rows 1 thru rangeStart of theTable
set fillStart to 0
set fillLength to 0
set startsCount to count of items in theStarts
repeat with i from 1 to startsCount
set fillStart to (fillStart + (item i of theStarts))
end repeat
set theHeights to height of rows rangeStart thru rangeEnd of theTable
set heightsCount to count of items in theHeights
repeat with i from 1 to heightsCount
set fillLength to (fillLength + (item i of theHeights))
end repeat
set fillLength to (fillLength * 12)
set fill color of rows rangeStart thru rangeEnd of theTable to swatch theGrad
set properties of rows rangeStart thru rangeEnd of theTable to {gradient fill start:{18, fillStart}, gradient fill angle:-90, gradient fill length:fillLength}
if theGrad = "SV Gradient 1" then
set theGrad to "SV Gradient 2"
else
set theGrad to "SV Gradient 1"
end if
end repeat
end tell
end tell
Am I using the wrong approach or can I add a page identifier somehow?
Technical Details
Message-ID:
<1de9d1fb.-1@WebX.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!nntp.infostrada.it!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,de15d8744890b6da,start X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-07-07 13:07:57 PST From: "Peter Hedrington" <phedrington@hfmmag.com> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: vertical gradients in multipage table? Message-ID: <1de9d1fb.-1@WebX.la2eafNXanI> Date: Mon, 7 Jul 2003 12:42:19 -0700 Lines: 65 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit