ScriptSpot

Forum topic · Scripts Wanted

find string

By dussla · 2012-06-16

Description

i used findstring for select same name object

example)
there is obj1 obj2 obj3 obj4 obj5 obj1 objs

in there , i would like to select obj1 name only
but if i use findstring function ,
that fuction collect all obj* objects

how can i select same name object with findsting fuction ?

Comments (8)

try this thing fellafn

fajar · 2013-12-25

try this thing fella



fn selectObject theName=
(
select (for i in objects where (matchpattern i.name pattern:theName) collect i)
)
selectObject "obj1"

PS: obj1 refer as name of obj not direct obj

....remember to add "" before and after the name object...but if youre using edit.text you dont need that

barigazy · 2013-12-25

In most cases you need to add

"*"

except you search for exact name.
Also "ignoreCase" argument can be important.

Use finditem

barigazy · 2012-06-16


objNameArr = for n in $Obj* collect n.name
--#("Obj5", "Obj4", "Obj3", "Obj2", "Obj1")
select (getnodebyname objNameArr[(finditem objNameArr "Obj1")])

ok thank you pls , can you answer same layer

dussla · 2012-06-16

ok i see same object find way thank you

in layers

obj1 obj2 obj3 obj4 layers

how can i find same obj1 layer ?

barigazy · 2012-06-16

Are you want to find out in which the layer is obj1?

dussla · 2012-06-16

yes
0. layer name in text box
1. collect layer name
2. current layer layer name in text box
or turn on layer name in text box

barigazy · 2012-06-16

If you want to know obj layer name just use

$Obj1.layer.name
--or if you want to collect objs layer names (unique one)
layerNamesArr = #()
for o in $Obj* do appendifunique layerNamesArr o.layer.name

wow ,barigazy thank you

dussla · 2012-06-17

always thank you
you are my sunshine
if you help me , mabey i can't do anything
you are best kindly person