Adobe Illustrator CS Scripting Guide
Example 3.1
In the example below, the selection property has all of the properties that character or
any other text class would have.
-- Make the currently selected text superscript
tell application "Illustrator CS"
-- Make sure one or more characters of text are selected
set selectedText to selection of current document
if class of selectedText is text or ¬
class of selectedText is character then
-- Adjust the properties of the selected text to superscript it
set fontSize to size of selectedText
set fontBaseline to baseline shift of selectedText
set properties of selectedText to ¬
{size:fontSize / 2, baseline shift:fontBaseline + (fontSize / 2)}
end if
end tell
Example 3.2
This example demonstrates how to use character properties to create unique effects from a
script.
(* Distort every character in the first text frame of a document by incrementally
modifying the horizontal scaling of each character to give the effect of
stretching words out *)
-- A smaller value for this property means more difference between largest and
-- smallest horizontal scaling of the characters
property pVariability : 1.0
tell application "Illustrator CS"
-- Is there is a document and a text frame to work with
if (exists text frame 1 of current document) then
-- Make sure the text frame contains some text
set textFrame to first text frame of current document
if textFrame is not "" then -- contains some text
-- Gather info needed to calculate the scale factor
12 Aug 03
75