Illustrator change stroke color script question

Hello, I am trying to change the stroke color of all path items of a illustrator document whose color is not “Pete Blue” to “DieLine”

tell application "Adobe Illustrator"
	tell document 1
		set (stroke color of every path item whose fill color is not {class:spot color info, tint:100.0, spot:spot "Pete Blue"}) to {class:spot color info, tint:100.0, spot:spot "DieLine"}
	end tell
end tell

The problem is that it turns everything “DieLine”

Any help would be appreciated.

Using Illustrator CS5

Hi. I’m using a much earlier version”CS”so I don’t know for sure if this is applicable to yours, however, it requires an explicit get to realize the spot property, when not using index references.


tell application "Illustrator CS"'s document 1
	set (path items whose fill color is not {class:spot color info, tint:100.0, spot:get spot "Pete Blue"})'s stroke color to {class:spot color info, tint:100.0, spot:get spot "DieLine"}
end tell

Your code errors on my CS5.1. This code works but only if there are no unfilled objects, whereupon it errors. It’s getting late and Illustrator is too irritating to continue at the moment! Hope this gives you a start.

tell application "Adobe Illustrator"
	tell document 1
		set stroke color of every path item whose name of spot of fill color is not "Pete Blue" to {class:spot color info, tint:100.0, spot:spot "DieLine"}
	end tell
end tell

Edit: I’ve just seen Marc Anthony’s post and it works a treat. Marc “ how on earth did you figure that stuff out? Is it written in a guide somewhere?

mark, that worked great.

Is there a way to have it cycle through a list of colors not to convert? Every file will have different colors that I need to keep as is. I will be passing this list of colors from a external source into a applescript list called colorsToKeep.

any idea’s? Thanks again

I knew this particular application from past tinkerings and just watching the event log. If something should occur but doesn’t”especially where a name is involved”get may need to be specified.

It would become cumbersome to deal with multiples in this property-laden format. You can add colors for exclusion to this statement:


tell application "Illustrator CS"'s document 1
	set (path items whose its fill color's spot's name is not "Pete Blue" and fill color's spot's name is not "Orange")'s stroke color to {class:spot color info, tint:100.0, spot:get spot "DieLine"}
end tell