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

Script - Rename Artboards + Number suffix

Participant ,
Feb 10, 2023 Feb 10, 2023

Copy link to clipboard

Copied

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

Views

1.0K

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

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
...

Votes

Translate

Translate
Adobe
Participant ,
Feb 10, 2023 Feb 10, 2023

Copy link to clipboard

Copied

/*
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/

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

Copy link to clipboard

Copied

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

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

Copy link to clipboard

Copied

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/

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
Enthusiast ,
Feb 12, 2023 Feb 12, 2023

Copy link to clipboard

Copied

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

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

Copy link to clipboard

Copied

LATEST

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


-
www.instagram.com/mugen_labz/

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