ScriptSpot

Forum topic · Scripts Wanted

Rename layer.

By tuxmask75 · 2013-03-01

Description

Looking for a script that can rename current layer by object selected.

Comments (7)

this one also should work

Anubis · 2013-03-01

if selection.count >= 1 do LayerManager.current.setname selection[1].name

barigazy · 2013-03-01

Yep but he ask for solution where can rename the Layer of current selected object,
if i understend correctly.

who knows :)

Anubis · 2013-03-03

"rename current layer by object selected" sounds to me clear, but if it's as you say, then s'd be this one:

selection[1].layer.setname "New Name"

or maybe:

selection[1].layer.setname selection[1].name

barigazy · 2013-03-03

And also we need to check if...

if selection[1].layer.name != "0" do selection[1].layer.setname "New Name"

not necessary

Anubis · 2013-03-03

The name of base layer is read-only and no errors come if we try to modify it.

I did not that (..no errors

barigazy · 2013-03-03

I did not that (..no errors come if we try to modify it..). Thanks Panayot.

barigazy · 2013-03-01

You can changege object layer name like this:

fn renameObjLayer obj newLayerName: = if (objLayer = obj.layer.name) != "0" do
(
(LayerManager.getLayerFromName objLayer).setname newLayerName
)
--example
renameObjLayer $ newLayerName:"tuxmask75"