AICS3 find white items that overprint?

I want to search an Illustrator file for every white object that is set to overprint, and turn off the overprint setting.
This script works sometimes, but it seems to ignore compound paths and items in groups.

Anyone want to take a whack at it? Thanks in advance!

tell application "Adobe Illustrator"
	tell document 1
		set {total, lockMe, layerCount, whiteFill} to {0, false, count layers of it, {cyan:0.0, magenta:0.0, yellow:0.0, black:0.0}}
		repeat with x from 1 to layerCount
			set thisLayer to layer x of it
			name of thisLayer
			tell thisLayer
				if locked of thisLayer then
					set lockMe to true
					set locked of thisLayer to false
				end if
				try
					set fixThese to (every page item of it whose (properties of fill color is whiteFill) and (fill overprint is true)) 
					set total to total + (count fixThese)
					repeat with fixMe in fixThese
						set fill overprint of fixMe to false
					end repeat
				end try
				if lockMe then
					set locked of thisLayer to true
					set lockMe to false
				end if
			end tell
		end repeat
		if total = 0 then
			set theVerb to " white overprints needed to be"
		else if total = 1 then
			set theVerb to " white overprint was"
		else
			set theVerb to " white overprints were"
		end if
		display dialog (total as text) & theVerb & " fixed." buttons {"Thank You", "You're Welcome"} default button 1
	end tell
end tell

Hi

Checkout this i didn’t write it not even sure where i got it now. Hope it does what you want:

property highlightDot : 5.0

tell application "Adobe Illustrator"
	set suspects to {}
	try
		my unlockAll(1)
		if color space of document 1 is CMYK then
			tell document 1
				-- get all path items whose fill or stroke is set to overprint
				set checkObjects to every path item whose (fill overprint is true or stroke overprint is true) and hidden is false
				-- get all text frames with text set to have its fill or stroke overprint
				set textObjects to every text frame whose (overprint fill of text of it is true or overprint stroke of text of it is true) and hidden is false
				-- append checkObjects with textObjects
				set checkObjects to checkObjects & textObjects
				
				repeat with i from 1 to count of checkObjects
					set suspect to my changeWhiteOverprint(item i of checkObjects)
					if suspect is not missing value then set end of suspects to suspect
				end repeat
				
			end tell
		else
			-- not a CMYK document
		end if
	on error
		-- document 1 does not exist or some other problem :?
	end try
	if suspects is not {} then set selection to suspects
end tell


on changeWhiteOverprint(theObject)
	set returnObject to missing value
	tell application "Adobe Illustrator"
		if class of theObject is not text frame then
			set fillRef to fill color of theObject
			set strokeRef to stroke color of theObject
			(* *********************************************************** FILL CHECK *)
			if class of fillRef is CMYK color info then
				set {c, m, y, k} to {cyan of fillRef, magenta of fillRef, yellow of fillRef, black of fillRef}
				if c < highlightDot and m < highlightDot and y < highlightDot and k < highlightDot or opacity of theObject < highlightDot then
					set fill overprint of theObject to false
					set returnObject to theObject
				end if
			else if class of fillRef is spot color info then
				if tint of fillRef < highlightDot or opacity of theObject < highlightDot then
					set fill overprint of theObject to false
					set returnObject to theObject
				end if
			else if class of fillRef is gray color info then
				if gray value of fillRef < highlightDot or opacity of theObject < highlightDot then
					set fill overprint of theObject to false
					set returnObject to theObject
				end if
			end if
			(* *********************************************************** STROKE CHECK *)
			if class of strokeRef is CMYK color info then
				set {c, m, y, k} to {cyan of strokeRef, magenta of strokeRef, yellow of strokeRef, black of strokeRef}
				if c < highlightDot and m < highlightDot and y < highlightDot and k < highlightDot then
					set stroke overprint of theObject to false
					if returnObject is not missing value then set returnObject to theObject
				end if
			else if class of strokeRef is spot color info then
				if tint of strokeRef < highlightDot or opacity of theObject < highlightDot then
					set stroke overprint of theObject to false
					if returnObject is not missing value then set returnObject to theObject
				end if
			else if class of strokeRef is gray color info then
				if gray value of fillRef < highlightDot or opacity of theObject < highlightDot then
					set stroke overprint of theObject to false
					if returnObject is not missing value then set returnObject to theObject
				end if
			end if
		else -- must deal with AI's very stupid switch in terminology
			set fillRef to fill color of text of theObject
			set strokeRef to stroke color of text of theObject
			(* *********************************************************** FILL CHECK *)
			if class of fillRef is CMYK color info then
				set {c, m, y, k} to {cyan of fillRef, magenta of fillRef, yellow of fillRef, black of fillRef}
				if c < highlightDot and m < highlightDot and y < highlightDot and k < highlightDot or opacity of theObject < highlightDot then
					set overprint fill of text of theObject to false
					set returnObject to theObject
				end if
			else if class of fillRef is spot color info then
				if tint of fillRef < highlightDot or opacity of theObject < highlightDot then
					set overprint fill of text of theObject to false
					set returnObject to theObject
				end if
			else if class of fillRef is gray color info then
				if gray value of fillRef < highlightDot or opacity of theObject < highlightDot then
					set overprint fill of text of theObject to false
					set returnObject to theObject
				end if
			end if
			(* *********************************************************** STROKE CHECK *)
			if class of strokeRef is CMYK color info then
				set {c, m, y, k} to {cyan of strokeRef, magenta of strokeRef, yellow of strokeRef, black of strokeRef}
				if c < highlightDot and m < highlightDot and y < highlightDot and k < highlightDot then
					set overprint stroke of text of theObject to false
					if returnObject is not missing value then set returnObject to theObject
				end if
			else if class of strokeRef is spot color info then
				if tint of strokeRef < highlightDot or opacity of theObject < highlightDot then
					set overprint stroke of text of theObject to false
					if returnObject is not missing value then set returnObject to theObject
				end if
			else if class of strokeRef is gray color info then
				if gray value of fillRef < highlightDot or opacity of theObject < highlightDot then
					set overprint stroke of text of theObject to false
					if returnObject is not missing value then set returnObject to theObject
				end if
			end if
		end if
	end tell
	return returnObject
end changeWhiteOverprint

on unlockAll(doc)
	tell application "Adobe Illustrator"
		if class of doc is integer or class of doc is string then set doc to document doc
		my unlockAllLayers(1)
		try
			set locked of every page item of document 1 whose locked is true to false
		end try
	end tell
end unlockAll

on unlockAllLayers(doc)
	tell application "Adobe Illustrator"
		if class of doc is integer or class of doc is string then set doc to document doc
		tell doc
			set allLayers to layers
			repeat with i from 1 to count of allLayers
				set thisLayer to item i of allLayers
				if locked of thisLayer then set locked of thisLayer to false
				if (count of (layers of thisLayer)) > 0 then my unlockAllLayers(thisLayer)
			end repeat
		end tell
	end tell
end unlockAllLayers


wow. THANK YOU and thank whoever wrote it too.

And here’s my slightly modified version. It re-locks any layers that were locked beforehand, and it tells you how many items it fixed at the end. (And it only does fills, not strokes).

property highlightDot : 5.0

tell application "Adobe Illustrator"
	tell document 1
		set lockedLayers to (every layer of it whose locked is true)
	end tell
	set suspects to {}
	try
		my unlockAll(1)
		if color space of document 1 is CMYK then
			tell document 1
				-- get all path items whose fill or stroke is set to overprint
				set checkObjects to every path item whose (fill overprint is true) and hidden is false
				-- get all text frames with text set to have its fill or stroke overprint
				set textObjects to every text frame whose (overprint fill of text of it is true) and hidden is false
				-- append checkObjects with textObjects
				set checkObjects to checkObjects & textObjects
				
				repeat with i from 1 to count of checkObjects
					set suspect to my changeWhiteOverprint(item i of checkObjects)
					if suspect is not missing value then set end of suspects to suspect
				end repeat
				
			end tell
		else
			-- not a CMYK document
		end if
	on error
		-- document 1 does not exist or some other problem :?
	end try
	tell document 1
		repeat with lockMe in lockedLayers
			set locked of lockMe to true
		end repeat
	end tell
end tell
if (count of suspects) = 0 then
	set theVerb to " white overprints needed to be"
else if (count of suspects) = 1 then
	set theVerb to " white overprint was"
else
	set theVerb to " white overprints were"
end if
display dialog ((count of suspects) as text) & theVerb & " fixed." buttons {"Thank You", "You're Welcome"} default button 1

on changeWhiteOverprint(theObject)
	set returnObject to missing value
	tell application "Adobe Illustrator"
		if class of theObject is not text frame then
			set fillRef to fill color of theObject
			(* *********************************************************** FILL CHECK *)
			if class of fillRef is CMYK color info then
				set {c, m, y, k} to {cyan of fillRef, magenta of fillRef, yellow of fillRef, black of fillRef}
				if c < highlightDot and m < highlightDot and y < highlightDot and k < highlightDot or opacity of theObject < highlightDot then
					set fill overprint of theObject to false
					set returnObject to theObject
				end if
			else if class of fillRef is spot color info then
				if tint of fillRef < highlightDot or opacity of theObject < highlightDot then
					set fill overprint of theObject to false
					set returnObject to theObject
				end if
			else if class of fillRef is gray color info then
				if gray value of fillRef < highlightDot or opacity of theObject < highlightDot then
					set fill overprint of theObject to false
					set returnObject to theObject
				end if
			end if
			
		else -- must deal with AI's very stupid switch in terminology
			set fillRef to fill color of text of theObject
			(* *********************************************************** FILL CHECK *)
			if class of fillRef is CMYK color info then
				set {c, m, y, k} to {cyan of fillRef, magenta of fillRef, yellow of fillRef, black of fillRef}
				if c < highlightDot and m < highlightDot and y < highlightDot and k < highlightDot or opacity of theObject < highlightDot then
					set overprint fill of text of theObject to false
					set returnObject to theObject
				end if
			else if class of fillRef is spot color info then
				if tint of fillRef < highlightDot or opacity of theObject < highlightDot then
					set overprint fill of text of theObject to false
					set returnObject to theObject
				end if
			else if class of fillRef is gray color info then
				if gray value of fillRef < highlightDot or opacity of theObject < highlightDot then
					set overprint fill of text of theObject to false
					set returnObject to theObject
				end if
			end if
			
		end if
	end tell
	return returnObject
end changeWhiteOverprint

on unlockAll(doc)
	tell application "Adobe Illustrator"
		if class of doc is integer or class of doc is string then set doc to document doc
		my unlockAllLayers(1)
		try
			set locked of every page item of document 1 whose locked is true to false
		end try
	end tell
end unlockAll

on unlockAllLayers(doc)
	tell application "Adobe Illustrator"
		if class of doc is integer or class of doc is string then set doc to document doc
		tell doc
			set allLayers to layers
			repeat with i from 1 to count of allLayers
				set thisLayer to item i of allLayers
				if locked of thisLayer then set locked of thisLayer to false
				if (count of (layers of thisLayer)) > 0 then my unlockAllLayers(thisLayer)
			end repeat
		end tell
	end tell
end unlockAllLayers


Hi

Glad it helped you!

If you want to thank him yourself i managed to track down where i got this script from!!

http://homepage.mac.com/josephb/subpages/public_downloads/download_index.html

This is an excellent thread! Our Rips will remove all overprint commands so its best we remove them ahead a time to prevent any false expectations of overprinting on a PDF proof displaying overprints. Our Rips automatically set 0,0,0,100 to overprint, and that’s fine and not dictated by any overprint command within the file. Therefore, in my script I adjusted the dot value to 101. However, does anybody know of a simple way to have this work on text set to overprint as well?

Thanks in advance,
-Jeff