• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Script to rename artboard from text layer

New Here ,
Mar 08, 2023 Mar 08, 2023

Copy link to clipboard

Copied

I found a partial bit of the script to rename artboards from a text layer however if you want to apply the script to multiple boards you have to do it one by one. My question is how would I alter this to make it cycle through all artboards?

 

if (activeDocument.activeLayer.parent.typename == "LayerSet")

    activeDocument.activeLayer.parent.name = activeDocument.activeLayer.name;

Credit to r-bin

TOPICS
Actions and scripting , Windows

Views

828

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Mar 08, 2023 Mar 08, 2023

There might be some confusion because your code is renaming a LayerSet (group folder in the layers panel). Photoshop doesn't have artboards afaik, unlike Illustrator or InDesign.

 

But you can apply what the code is doing by iterating over an array (or collection) of ArtLayers in a for-loop. The wrinkle is Document.artLayers only gives top-level objects and doesn't check inside groups. So we'll need a helper function to recurse into those and find the layers. I've also added a conditional to check

...

Votes

Translate

Translate
Adobe
Explorer ,
Mar 08, 2023 Mar 08, 2023

Copy link to clipboard

Copied

There might be some confusion because your code is renaming a LayerSet (group folder in the layers panel). Photoshop doesn't have artboards afaik, unlike Illustrator or InDesign.

 

But you can apply what the code is doing by iterating over an array (or collection) of ArtLayers in a for-loop. The wrinkle is Document.artLayers only gives top-level objects and doesn't check inside groups. So we'll need a helper function to recurse into those and find the layers. I've also added a conditional to check if a layer is text, since you mentioned that's a requirement.

 

Code attached as plain txt.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 08, 2023 Mar 08, 2023

Copy link to clipboard

Copied

quote

There might be some confusion because your code is renaming a LayerSet (group folder in the layers panel). Photoshop doesn't have artboards afaik, unlike Illustrator or InDesign.


By @Nick Combs

 

Hi Nick, thank you for contributing!

 

You are correct, in Photoshop's DOM, layerSet or layerSets are used to describe three separate layer types:

 

  • Layer Groups
  • Artboards
  • Frames

 

It takes the more esoteric AM code to differentiate between layer sets, artboards and frames.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 10, 2023 Mar 10, 2023

Copy link to clipboard

Copied

LATEST

Thanks Stephen. Always happy to learn something new!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines