do something based on object name prefix

hello

i´m struggling with some basic concepts lately

what i am trying to do is do something based on the object name prefix..
i am trying something like this:

for o in selection as array do if o.name == 'Box'* do print "it works!"

but the * dosnt work with the == signal i i think

any help on this is greatly apreciated

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Anubis's picture

Pathname Literals

Search in the mxs-help for "Pathname Literals" topic. For ex.: $*box* - will collect all objects with 'box' (at any place) of their names, like: "the_box01", "boxer", etc., while $box* will collect all with prefix (starting with) 'box' name.

objs = $box* as array
for obj in objs do print obj.name

For more precision tests check matchPattern() function.

Cheers!

my recent MAXScripts RSS (archive here)

mjbg's picture

Thank you Anubis.. i belive

Thank you Anubis..

i belive matchPattern is what i wanted

for o in selection as array do if (matchPattern o.name Pattern:"*Box*") == true do print "it works!"

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.