Skip to main content
Solved

Renaming Layers changes name


Ronak_Mokashi

I have been trying to batch rename my layers using the developer console. My use case is - I want to identify all INSTANCE nodes in the current page and prepend a “E-” to all the matching layers. I am able to prepend the “E-” but it changes the layer name to [Node 4:247], etc.

My code is as -

const pencil = Figma.currentPage.findAll(n => n.type === “INSTANCE”).slice()
for(var j=0;j<=pencil.length;j++){
pencil[j].name= "✏️ "+pencil[j]
}

Can someone let me know what am I doing wrong. I am not very good with coding. Thanks in Advance!

Best answer by tank666

const pencil = figma.currentPage.findAll(n => n.type === “INSTANCE”)
for(var j=0;j<=pencil.length;j++){
pencil[j].name= ":pencil2: "+pencil[j].name
}
View original

2 replies

tank666
  • 4873 replies
  • Answer
  • April 21, 2021
const pencil = figma.currentPage.findAll(n => n.type === “INSTANCE”)
for(var j=0;j<=pencil.length;j++){
pencil[j].name= ":pencil2: "+pencil[j].name
}

Ronak_Mokashi

Awesome! Thanks again. This worked 🙂


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings