Newbie Trying to Write Script for Adobe Illustrator
Newbie Trying to Write Script for Adobe Illustrator
- Subject: Newbie Trying to Write Script for Adobe Illustrator
- From: Ben at Work <email@hidden>
- Date: Mon, 28 Jun 2004 21:52:05 +1000
Hi,
I am new to scripting and am having trouble with a task:
I am trying to automate the arrangement of elements in an Illustrator
file. I have thousands of files to process and each takes me about two
minutes to finish.
I need to open the file; un-group it twice; create four more layers;
then select all elements of the same color and group them; move them to
their own layer; once all color groups have been separated, I need to
delete the original artwork on Layer 1; create a black box for Layer 1
with a stroke on it; copy the stroke only to each of the other layers;
select all elements on a layer and copy to the layer beneath; color
those elements to the same color as the elements on the new layer;
group these; copy these to the layer below etc. until I have five
layers of finished artwork; save.
I have tried Illustrator's Automate feature with very limited success.
I have thus turned to AppleScript. With AppleScript I have managed to
achieve some of these tasks and I am hopeful of achieving my goal,
however, I am unable to select a page item based on its color
properties. If I create some test artwork I can acheive results. If I
ask for the properties of the test artwork I can see its color. If I
ask for the properties of the real artwork - color is not there. The
files I am trying to work on have come from Flash as an Illustrator 6
sequence. I have placed the Test_0001.ai file on the web at:
www.phoenix-productions.com.au/Test_0001
Has anyone got any ideas as to how I might move forward on this?
Thanks for your consideration.
Ben.
The following is a script to get the properties of one of the files
that Flash created:
tell application "Illustrator CS"
get properties of page item 1 of layer "Layer 1" of document
"Test_0001.ai"
--> {URL:"", layer:layer 1 of document 1, locked:false, hidden:false,
selected:false, position:{-1.013671875, 15.0}, width:11.013671875,
height:15.1650390625, geometric bounds:{-1.013671875, 15.0, 10.0,
-0.1650390625}, visible bounds:{-1.013671875, 15.0, 10.0,
-0.1650390625}, control bounds:{-2.7998046875, 15.0, 10.0,
-0.7998046875}, name:"", blend mode:normal, opacity:100.0,
isolated:false, knockout:disabled, editable:true, sliced:false,
visibility variable:missing value, wrapped:false, wrap offset:missing
value, wrap inside:missing value, container:layer 1 of document 1, best
type:reference, default type:reference, class:compound path item,
index:1}
end tell
Note the lack of color references.
The following is a script to get the properties of a test file that I
made in Illustrator:
tell application "Illustrator CS"
get properties of page item 1 of layer "Layer 1" of document
"Sample.ai"
--> {closed:true, area:1.4514E+4, guides:false, filled:true, fill
color:{class:CMYK color info, cyan:0.0, magenta:100.0, yellow:100.0,
black:0.0}, fill overprint:false, stroked:false, stroke color:{class:no
color info}, stroke overprint:false, stroke width:1.0, stroke
dashes:{}, stroke dash offset:0.0, stroke cap:butted, stroke
join:mitered, stroke miter limit:4.0, clipping:false, evenodd:false,
resolution:800.0, note:"", entire path:{{class:path point info,
anchor:{735.0, 185.0}, left direction:{735.0, 185.0}, right
direction:{735.0, 185.0}, point type:corner}, {class:path point info,
anchor:{612.0, 185.0}, left direction:{612.0, 185.0}, right
direction:{612.0, 185.0}, point type:corner}, {class:path point info,
anchor:{612.0, 303.0}, left direction:{612.0, 303.0}, right
direction:{612.0, 303.0}, point type:corner}, {class:path point info,
anchor:{735.0, 303.0}, left direction:{735.0, 303.0}, right
direction:{735.0, 303.0}, point type:corner}}, selected path points:{},
polarity:positive, URL:"", layer:layer 1 of document 1, locked:false,
hidden:false, selected:false, position:{612.0, 303.0}, width:123.0,
height:118.0, geometric bounds:{612.0, 303.0, 735.0, 185.0}, visible
bounds:{612.0, 303.0, 735.0, 185.0}, control bounds:{612.0, 303.0,
735.0, 185.0}, name:"", blend mode:normal, opacity:100.0,
isolated:false, knockout:disabled, editable:true, sliced:false,
visibility variable:missing value, wrapped:false, wrap offset:missing
value, wrap inside:missing value, container:layer 1 of document 1, best
type:reference, default type:reference, class:path item, index:1}
end tell
Note the color references.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.