ScriptSpot

Forum topic · General Scripting

"Select" and "select exclude" objects by name

By chooj · 2015-12-06

Description

Is there a way to select all objects, except some, by name? For example, I want to select and delete all, except objects named "important_object_001", "important_object_002", "important_object_003". How should I do this?

Comments (2)

.

miauu · 2015-12-06


(
	objToSkipArr = #("important_object_001", "important_object_002", "important_object_003")
	
	objsToDel = for o in objects where (findItem objToSkipArr o.name) == 0 collect o
	delete objsToDel	
)

chooj · 2015-12-06

thanx! A little bit tricky for me, but I will try to understand )