ScriptSpot home

Forum topic · General Scripting

Rename whitespace with underscore

By Dragen 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)
Andrey

rename

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
Reply to Andrey
Dragen ilic

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