Delete Unpainted Objects Not Grouped

In the script below I would really like to include an extra parameter but I can’t figure out how.
I want the script to be able to not delete the unpainted objects if the paths themselves were part of a group.
Can someone please help me with this?
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 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

hi jeff,

I think you could do it like so:

delete get every path item of every layer

(grouped items should not be deleted then since their container is ‘group’, not ‘layer’

D.

Thank you Dominik,
This seems to work perfectly. I am including the new modified script. If you don’t mind, and/or if you have the time, could you glance it over.
I am not certain if my code is set the way it really should be.
But if not.
Many thanks again :slight_smile:

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 clipping is false and filled is false and class of stroke color is no color info)
				set unpainted to delete every path item of every layer
				delete unpainted
			end try
		end tell
	end tell
end deleteUnpainted

jeff,

I can’t try, but I think this might work:


try
delete (every path item of every layer whose (filled is false and clipping is false and class of stroke color is no color info))
end try

D.

Dominik,
Thank you very much for the much cleaner and better code. It is working Great!!!

jeff