Applescript / Javascript > Adobe Illustrator scripting

Illy, can't make data

(1/1)

AutoFetishist:
Anyone see where this is going wrong:


--- Code: ---
tell application "Adobe Illustrator"
tell document 1

activate
--return properties of every path item
set ruler origin to {0, 0}
set zoom of view 1 to 0.89
set theStump to make new rectangle with properties
{position:{282.9570703125, 232.595703125}, name:"theStump", height:23.5, width:43.0, filled:true, fill color:{class:CMYK color info, cyan:25.0, magenta:42.0, yellow:100.0, black:37.0}, stroked:false, stroke color:{class:no color info}}
end tell
end tell

--- End code ---

Getting error "Can't make some data into the expected type"

Publi-Script:
Hi there,

Simply remove ", stroke color:{class:no color info}" from your script and it will work.

Also, when confronted to such a situation, break up your properties to help you see which member is causing the problem:

--- Quote ---001     tell application "Adobe Illustrator"
002          tell document 1
003               activate
004               --return properties of every path item
005               set ruler origin to {0, 0}
006               set zoom of view 1 to 0.89
007               set theProps to {}
008               set theProps to theProps & {position:{282.9570703125, 232.595703125}}
009               set theProps to theProps & {name:"theStump"}
010               set theProps to theProps & {height:23.5}
011               set theProps to theProps & {width:43.0}
012               set theProps to theProps & {filled:true}
013               set theProps to theProps & {fill color:{class:CMYK color info, cyan:25.0, magenta:42.0, yellow:100.0, black:37.0}}
014               set theProps to theProps & {stroked:false}
015               set theProps to theProps & {stroke color:{class:no color info}}
          
016               set theStump to make new rectangle with properties theProps
017          end tell
018     end tell

--- End quote ---
Then, it is just a matter of commenting out lines between lines 008 thru 015 to find out where this is going wrong.

AutoFetishist:
Very nice advice. Thank you.

ps.
why is Illustrator hiccuping on stroke color?

Publi-Script:
It is not "hiccuping on stroke color", it is hiccuping on "no color info". As far as I can tell, an element always has a stroke and a fill color but there are other flags (filled and stroked) that are used to determine if they will show or not so setting a color to "no color info" simply does not seem possible.

Navigation

[0] Message Index

Go to full version