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.
/*
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
...
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();
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
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.
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.
Copy link to clipboard
Copied
looks good ! I'll def check what you are coding also
Thanks for sharing 🙂
Copy link to clipboard
Copied
Thanks! Your script save a lot time! Works very well.
Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Oh, yeah that makes sense!
Still the script is super useful and pretty cool! Thanks for answering 😄
Find more inspiration, events, and resources on the new Adobe Community
Explore Now