ScriptSpot home

Forum topic · General Scripting

loop question

By mxdsa · 2018-11-16

Description

Hello,
This is probably very simple.
Why won't this work when only one object is selected?
Thanks!
Caleb


	on btn_objRenamer pressed do (
		for n in 1 to $.count do (
			$[n].name = $[n].name + objSuffix
		)
	)
Comments (3)
pixamoon

`

Hi,

Do not use for that "$" but "selection"


on btn_objRenamer pressed do (
		for n in 1 to selection.count do (
			selection[n].name = selection[n].name + objSuffix
		)
	)

Best,
Pixamoon

Reply to pixamoon
Kailash Diengdoh

simplified version


on btn_objRenamer pressed do 
(
	for obj in selection do
	(
		obj.name += objSuffix
	)
)