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

Script - Rename Artboards + Number suffix

Participant ,
Feb 10, 2023 Feb 10, 2023

Hello 
I was about to post, and thanks to chat gpt I've had a working solution. 
Just posting so users can find the solution for themselves later on 

Script is on second post 🙂 

Cheers pals!

This script will rename the artboards in the active document by using the name of the document and adding a suffix number. 
The suffix number will have a fixed width of 2 digits and be zero-padded if necessary. 
For example, if the document name is "Myfilename.ai", the first artboard will be renamed to "Myfilename 01", 
the second artboard to "Myfilename 02", and so on.

-
www.instagram.com/mugen_labz/
TOPICS
Scripting
3.0K
Translate
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

Participant , Feb 10, 2023 Feb 10, 2023
/*
This script will rename the artboards in the active document by using the name of the document and adding a suffix number. 
The suffix number will have a fixed width of 2 digits and be zero-padded if necessary. 
For example, if the document name is "Myfilename.ai", the first artboard will be renamed to "Myfilename 01", 
the second artboard to "Myfilename 02", and so on.

By chat GPT
*/

function artBoardName_serial() {
  var doc = app.activeDocument;
  for (var i = 0, l = doc.artboards.length
...
Translate
Adobe
Participant ,
Feb 10, 2023 Feb 10, 2023
/*
This script will rename the artboards in the active document by using the name of the document and adding a suffix number. 
The suffix number will have a fixed width of 2 digits and be zero-padded if necessary. 
For example, if the document name is "Myfilename.ai", the first artboard will be renamed to "Myfilename 01", 
the second artboard to "Myfilename 02", and so on.

By chat GPT
*/

function artBoardName_serial() {
  var doc = app.activeDocument;
  for (var i = 0, l = doc.artboards.length; i < l; i++) {
    // THIS IS WHERE THE RENAMING HAPPENS
    var suffix = (i + 1).toString();
    while (suffix.length < 2) {
      suffix = "0" + suffix;
    }
    var newName = doc.name.replace(".ai", "") + " " + suffix;
    doc.artboards[i].name = newName;
  }
}

function renameArtBoard_MAIN() {
  if (app.documents.length == 0) {
    alert("No Open / Active Document Found");
  } else {
    artBoardName_serial();
  }
}

renameArtBoard_MAIN();

-
www.instagram.com/mugen_labz/
Translate
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 ,
Feb 10, 2023 Feb 10, 2023

Cool, Max! I got ChatGPT to tailor an algorithm for me the other day. It took a lot of iterating, but that was because my specification was lacking, and the final result was useful, if not perfect. Amazing tool. - Mark

Translate
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
Participant ,
Feb 10, 2023 Feb 10, 2023

well i'm trying out GPT for sure !
I'm IT enthusiast so I can understand, tweak and experiment in scripting but lack full programming skills
GPT surely fill the gap here 

Interestingly, it would still take some trial and error, say 10 iterations, before getting a good output. 
most of the time, no luck at all and no solution at the end without base material

Some factors to consider here, aiming towards a final good answer 
- User specification does not state or clarify the request clearly enough (so fine-tuning the question fine-tune the script) 
- It works way better when providing base material to work from. So in this example I already found a script to rename all artboards to the same name, pasted the code, and asked GPT to add a suffix system. 
- On rare occasions, GPT just doesn't get it right on the first trial, just re-roll the question. 

 


-
www.instagram.com/mugen_labz/
Translate
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
Enthusiast ,
Feb 12, 2023 Feb 12, 2023

I added a {fn} placeholder to my BatchRenamer script to insert the filename after reading your question. The original artboard name is deleted from the Find & Replace fields.

batchRenamer.jpg

Translate
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
Participant ,
Feb 13, 2023 Feb 13, 2023

looks good ! I'll def check what you are coding also 
Thanks for sharing 🙂 


-
www.instagram.com/mugen_labz/
Translate
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
New Here ,
Oct 03, 2024 Oct 03, 2024

Thanks! Your script  save a lot time! Works very well.

Translate
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
New Here ,
Jul 02, 2025 Jul 02, 2025

Hey! Just wanted to say the BatchRenamer is super cool — really helpful tool.

I was wondering, would it be possible to add an option to define a range for the prefix and suffix, so I can type it in instead of manually checking the boxes? For example, if I have 100 artboards but only want to rename 1-45, it'd be great to type that range directly rather than clicking each one.

And if it's not too complicated, maybe the option to set up multiple renaming ranges at once? Like:

  • Range 1-25: Prefix {fn}_{nu:1451}

  • Range 26-45: Prefix {fn}_{nu:1465}

That way the process is a bit faster without reopening the script for each batch.

Not sure if some of that is already possible — if it is, feel free to point me in the right direction. Thanks again for making such a handy tool!

Translate
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
Enthusiast ,
Jul 02, 2025 Jul 02, 2025

Hi. This is an interesting idea about simplifying index control. In my scripts I often use a numeric range input field for object indexes. But BatchRenamer was based on the original code by Qwertyfly, which used a column of checkboxes. At that time I did not change it.

 

Multiple ranges can be described with commas and hyphens in one input field to set a common renaming rule. But you mean that each range should have its own renaming rule - in scripting it is difficult to create such an interface, since some kind of "+" button is required, which would add a new line for entering the range and rule to the dialog box, and there can be many such lines from top to bottom

Translate
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
New Here ,
Jul 09, 2025 Jul 09, 2025
LATEST

Oh, yeah that makes sense! 
Still the script is super useful and pretty cool! Thanks for answering 😄

 

Translate
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