Remove unpainted objects (not clipping paths)

The below script is excellent (and not mine), yet I believe there is one issue in regards to clipping masks. The script removes all non painted objects from an Illustrator CS document. But since a clipping mask is set to a non painted object, the script will remove those as well. :frowning:

Is is possible to add a parameter that only deletes “non-grouped” and unpainted objects? That should solve that minor issue.

Thanks,
jeff

tell application "Illustrator CS" to activate
deleteUnpainted(1)

on deleteUnpainted(doc)
	tell application "Illustrator CS"
		if class of doc is integer or class of doc is string then set doc to document doc
		tell doc
			try
				set unpainted to (every path item whose filled is false and class of stroke color is no color info)
				delete unpainted
			end try
		end tell
	end tell
end deleteUnpainted

tell application "Illustrator CS" to activate
deleteUnpainted(1)

on deleteUnpainted(doc)
	tell application "Illustrator CS"
		if class of doc is integer or class of doc is string then set doc to document doc
		tell doc
			try
				set unpainted to (every path item whose clipping is false and filled is false and class of stroke color is no color info)
				delete unpainted
			end try
		end tell
	end tell
end deleteUnpainted

Thank you Jerome,
That additional parameter did the trick (even better than my suggestion). So now useless unpainted grouped items will still be deleted - Nice :slight_smile:
Thanks,

jeff