ScriptSpot

Forum topic · General Scripting

Simple naming object script

By airbrush · 2012-09-19

Description

Hi all,

Wonder if someone can help me out. I just want a simple script to name selected object. A small window with three buttons, CollisionBox, CollisionConvex, CollisionMesh and named exactly as indicated.

much appreciated.

Comments (3)

airbrush · 2012-09-19

thank you :)

*.ms

barigazy · 2012-09-19

Also here is *.ms

Attachments

this is your script

barigazy · 2012-09-19


(
try (destroyDialog ::CollisionRoll) catch()
rollout CollisionRoll " Collision Namer"
(
dropdownlist ddl_names "" items:#("CollisionBox", "CollisionConvex", "CollisionMesh") pos:[5,5] width:150 height:10
checkbox cb_use " Use Unique Name" pos:[6,30] width:190 height:16
edittext et_objsname "" pos:[1,50] fieldwidth:150 height:17 enabled:off
button btn_rename "Rename!" pos:[5,70] width:150 height:18

on cb_use changed state do (et_objsname.enabled = state ; ddl_names.enabled = not state)
on btn_rename pressed do
(
if selection.count == 0 then messageBox "Select Some Object First!" title:"Warning" beep:off else
(
local objName = if not cb_use.checked then ddl_names.items[ddl_names.selection] else
(
if et_objsname.text == "" then (messageBox "Specify name!" title:"Warning" beep:off ; undefined) else et_objsname.text
)
if objName != undefined do (for o in selection do o.name = uniquename objName)
)
)
)
createdialog CollisionRoll 160 92 10 110 style:#(#style_titlebar, #style_sysmenu, #style_toolwindow) ; ok
)