Adobe 26001360 - Illustrator CS - PC Manual page 114

Scripting guide
Hide thumbs Also See for 26001360 - Illustrator CS - PC:
Table of Contents

Advertisement

114
Notes
Illustrator's gradient stop object represents a point on a specific gradient defined in the
Illustrator application. Each gradient stop specifies a color change in the containing gradient.
Example 16.1
This example demonstrates how to reverse the colors in a gradient by getting, then switching,
the colors of the contained gradient stops.
-- This handler reverses the colors in gradient identified
-- by the gradientRef parameter
on ReverseGradientColors(gradientRef)
tell application "Illustrator CS"
-- Get a list of the gradient's colors
set colorList to color of every gradient stop of gradientRef
-- Tell AppleScript to reverse the order of the list
set colorList to reverse of colorList
-- Iterate over the gradient resetting its colors
set colorCount to count items in colorList
repeat with i from 1 to colorCount
set color of gradient stop i of gradientRef to (item i of colorList)
end repeat
end tell
end ReverseGradientColors
-- call handler
tell application "Illustrator CS" to set gradientRef to ¬
gradient 1 of document 1
ReverseGradientColors(gradientRef)
12 Aug 03
AppleScript Reference

Advertisement

Table of Contents
loading

This manual is also suitable for:

Illustrator cs

Table of Contents