ScriptSpot

Forum topic · General Scripting

Rename whitespace with underscore

By Dragan_ilic · 2019-09-28

Description

A little question, is it possible to rename objects by typing in the edittext field f.e. "Box version concept" and it would be automatically rename the objects with an underscore f.e. "Box_version_concept"

Thx

Comments (2)

rename

andrfil · 2019-10-17

Try this:


rollout renameObject "Rename"
(
	edittext etName "name:" text:""
	
	fn replaceWtoU txt = substituteString etName.text " " "_"
	
	on renameObject open do etName.text = selection[1].name
	
	on etName changed txt do selection[1].name = replaceWtoU etName.text
)
createDialog renameObject

Dragan_ilic · 2019-11-28

Thank you, but is it possible without realtime rename, but instead with a Button (rename now)?