Indesign gradients help needed

Hi,

I can’t get my head round gradient stops (or gradients at all, truth be told). Could someone please show me how to create a new InDesign CS2 gradient using predefined swatches (1,2 3, 4, 5 and 6) at specified locations on the gradient ramp? I’m sure it’s easy, I’m just a bit of a noob. This is what I’m using so far …

set myGrad1 to make color with properties {color value:{95, 83, 82, 90}, name:“Color_a”}
set myGrad2 to make color with properties {color value:{0, 0, 0, 96}, name:“Color_b”}
set myGrad3 to make color with properties {color value:{0, 0, 0, 86}, name:“Color_c”}
set myGrad4 to make color with properties {color value:{0, 0, 0, 60}, name:“Color_d”}
set myGrad5 to make color with properties {color value:{0, 0, 0, 20}, name:“Color_e”}
set myGrad6 to make color with properties {color value:{0, 0, 0, 0}, name:“white”}

		set myGradient to make new gradient with properties {type:linear}
		tell myGradient

And then I’m completely lost!
Any and all help much appreciated.

Sam

Hi sam5678,

Maybe this sample code will point you in the right direction.

Also the Scripting Guide for Illustrator includes sample code (maybe it also applies for InDesign?):


property pGradientName : "RGB Hot Streak" 
tell application "Adobe Illustrator 10" 
if not (exists gradient pGradientName in current document) then 
set newgradient to make new gradient at beginning of current document 
with properties {name:pGradientName, kind:linear} 
-- Since all new gradients are created with 2 gradient stops, 
-- create another stop for the 3 stop gradient 
make new gradient stop at beginning of newgradient 
set properties of gradient stop 1 of newgradient to {midpoint:50.0, ramp point:0.0,¬ 
color:{red:255.0, green:255.0, blue:0.0}} 
set properties of gradient stop 2 of newgradient to {midpoint:50.0, ramp point:50.0, color:{red:255.0, green:127.0, blue:127.0}} 
set properties of gradient stop 3 of newgradient to {midpoint:50.0, ramp point:100.0, color:{red:255.0, green:0.0, blue:0.0}} 
end if 
end tell