ScriptSpot

Forum topic · General Scripting

How do I? if $ == $box* then

By yunusbbayram · 2011-04-15

Description
if $ == $box001 then

(
sphere()
) 
else 
(
Cone ()
)

if $box001 is selected, then create box else create cone
This code works.

if $ == $box* then

(
sphere()
) 
else 
(
Cone ()
)

box001 or box002 or box...etc. if one of them is selected, then create box else create cone

but the code does not work.
How do I?

Comments (1)

( local foundABox =

Graph · 2011-04-24


(
	local foundABox = false
	
	for o in selection while not foundABox do if matchPattern o.name pattern:"box*" ignoreCase:true do foundABox = true
	
	if foundABox then 
	(
		print "sphere()"
	)
	else
	(
		print "cone()"
	)
	
)