Change Spot Color / Remove Spot COlor objects in Adobe Illustrator

Hi,

I want to remove a certain object with a specific spot color from my document. Is it possible to select it by script?

Select by Spot Color? Convert certain spot color to CMYK Color? Remove objects with a certain spot color?

Should be a batch if possible.

Thanks!

Christoph

Here’s a script to find all page items containing a certain spot color (by name) as the fill, the stroke, or the colorant - which I think are the only options for it’s use.

tell application "/Applications/Adobe Illustrator CS6/Adobe Illustrator.app"
	tell the current document
		set desiredSpot to "Liquid Gold"
		set allItems to every page item
		set spotItems to {}
		repeat with i from 1 to count of allItems
			set anItem to item i of allItems
			set {spotFill, spotStroke, spotRaster} to {"", "", ""}
			try
				set spotFill to the name of the spot of the fill color of anItem
			end try
			try
				set spotStroke to the name of the spot of the stroke color of anItem
			end try
			try
				set spotRaster to item 1 of the colorants of anItem
			end try
			if (spotFill is desiredSpot) or (spotStroke is desiredSpot) or (spotRaster is desiredSpot) then copy anItem to the end of spotItems
		end repeat
	end tell
end tell

This removes the objects containing the spot color:

tell application "/Applications/Adobe Illustrator CS6/Adobe Illustrator.app"
	tell the current document
		set desiredSpot to "Liquid Gold"
		set allItems to every page item
		set spotItems to {}
		repeat with i from 1 to count of allItems
			set anItem to item i of allItems
			set {spotFill, spotStroke, spotRaster} to {"", "", ""}
			try
				set spotFill to the name of the spot of the fill color of anItem
			end try
			try
				set spotStroke to the name of the spot of the stroke color of anItem
			end try
			try
				set spotRaster to item 1 of the colorants of anItem
			end try
			if (spotFill is desiredSpot) or (spotStroke is desiredSpot) or (spotRaster is desiredSpot) then copy anItem to the end of spotItems
		end repeat
		
		repeat with i from (count of spotItems) to 1 by -1
			delete item i of spotItems
		end repeat
	end tell
end tell

This converts all the items containing a spot to CMYK, by converting the document swatch:

tell application "/Applications/Adobe Illustrator CS6/Adobe Illustrator.app"
	tell the current document
		set theSpot to spot "Liquid Gold"
		set the color type of theSpot to process color
	end tell
end tell