Adobe 26001360 - Illustrator CS - PC Manual page 96

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

Advertisement

96
Example 8.1
The following example shows how to make sure a document is open before setting any of the
application's default properties.
-- Check to make sure a document is open in Illustrator
-- before setting the application's default stroke width to 8 points
tell application "Illustrator CS"
if not (document 1 exists) then
make new document with properties {color space: CMYK, width: 100.0, height:
50.0}
end if
set the default stroke width of document 1 to 8.0
end tell
Example 8.2
The following example shows how to make new documents with custom defaults.
-- Present a dialog to the user to choose a new document type
-- from, then create a new document with its properties set accordingly
-- Note:
You can only change writable document defaults when a document is open
-- Prompt user for new document properties from list of choices
set listChoice to (choose from list ¬
{"CMYK, filled, 2 pt stroke with dashes", ¬
"RGB, filled, no stroke", ¬
"RGB, no fill, 1 pt stroke"} ¬
with prompt "What kind of new document to create?")
if listChoice is not false then
-- Gather the values needed to set the document's properties
set documentType to item 1 of listChoice
set fillPaths to (documentType contains "filled")
set strokePaths to (documentType contains "pt stroke")
set strokeWidth to 0.0
if documentType contains "1 pt" then
set strokeWidth to 1.0
else if documentType contains "2 pt" then
set strokeWidth to 2.0
end if
if documentType contains "with dashes" then
12 Aug 03
AppleScript Reference

Advertisement

Table of Contents
loading

This manual is also suitable for:

Illustrator cs

Table of Contents