Beginner problem with MaxScript rename tool


#1

Hello,

Does anyone know how to avoid the jump of line when adding two variables as string? I think that might be my problem but…

I’m working in a custom Rollout floater for my daily work, and I want to do this rename thing to have it more handy.

I’m testing some veeeery basic code but there is no way to get it right If somebody could point why this doesn’t work well… I might be missing something very basic.


(
		X= (edt_mainRename.text) as string
		Y="001" as string
	undo "nToolFloat" on
	(			
		for obj in selection do
		(				
			obj.name=X+Y as string
			print obj.name as string
		)
	)
)

I would spect that my selected object would get the name of the variable followed by 001
so lets say 2 objects selected and if the first variable was “test”

test001
test001

right? well in the object name I get exactly that, but in the Layer explorer i get only “test” without the number.
And if I print obj.name, I get exactly this.

“test
001”

So I guess the problem is the jump of line… but no idea how to avoid that to happen.


#2

Ok

was because the funciont executed on the edit text " on return" when I changed it to a button press, no problem.
mmm don’t know the reason but now it works. :smiley: