Add Ref. No at starting of the custom artboard name

Explorer ,
Jul 31, 2022 Jul 31, 2022

Copy link to clipboard

Copied

Can we add Artboard Ref.no at starting of the each selected artboard name. I don’t want to lost given custom name. just to add Ref. No at starting of the custom artboard name

 

Add Artboard Ref. No at starting of the custom artboard name.png

TOPICS
Scripting

Views

112

Likes

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 , Jul 31, 2022 Jul 31, 2022

Maybe you will find this script useful. It has a lot more options https://github.com/creold/illustrator-scripts/blob/master/jsx/BatchRenamer.jsx
batch-renamer.gif

Likes

Translate

Translate
Participant ,
Jul 31, 2022 Jul 31, 2022

Copy link to clipboard

Copied

Maybe you will find this script useful. It has a lot more options https://github.com/creold/illustrator-scripts/blob/master/jsx/BatchRenamer.jsx
batch-renamer.gif

Likes

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 ,
Jul 31, 2022 Jul 31, 2022

Copy link to clipboard

Copied

Wow, Great, absolutely working

Sergey Osokin, you given me lot lot than I was expecting.

Thank you so much 🙂

Likes

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 ,
Aug 02, 2022 Aug 02, 2022

Copy link to clipboard

Copied

Hello Sergey Osokin,

How to define color for Numbers as you shown in animation?

Likes

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 ,
Aug 02, 2022 Aug 02, 2022

Copy link to clipboard

Copied

I added a variable with color to the function. This improvement is not available on GitHub

function showAbIndex(doc, lyrName) {
  var tmpLayer;
    
  try {
    tmpLayer = doc.layers.getByName(lyrName);
  } catch (e) {
    tmpLayer = doc.layers.add();
    tmpLayer.name = lyrName;
  }

  var color = new RGBColor();
  color.red = 255;

  for (var i = 0, len = doc.artboards.length; i < len; i++)  {
    doc.artboards.setActiveArtboardIndex(i);
    var currAb = doc.artboards[i],
        abWidth = currAb.artboardRect[2] - currAb.artboardRect[0],
        abHeight = currAb.artboardRect[1] - currAb.artboardRect[3],
        label = doc.textFrames.add(),
        labelSize = (abWidth >= abHeight) ? abHeight / 2 : abWidth / 2;
    label.contents = i + 1;
    // 1296 pt limit for font size in Illustrator
    label.textRange.characterAttributes.size = (labelSize > 1296) ? 1296 : labelSize;
    label.textRange.characterAttributes.fillColor = color;
    label.position = [currAb.artboardRect[0], currAb.artboardRect[1]];
    label.move(tmpLayer, ElementPlacement.PLACEATBEGINNING);
  }

  redraw();
}

 

Likes

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 ,
Aug 03, 2022 Aug 03, 2022

Copy link to clipboard

Copied

Uploaded a new version to Github, where you can set the index color in "CFG.idxColor: [255, 0, 0]"

Likes

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 ,
Aug 03, 2022 Aug 03, 2022

Copy link to clipboard

Copied

Thank You so much, this will save time to review pages while renaming the artboards at complex artwork

Likes

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
LEGEND ,
Aug 01, 2022 Aug 01, 2022

Copy link to clipboard

Copied

This would work:

function artboardRef() {
    var aDoc = app.activeDocument;
    for (i = 0; i < aDoc.artboards.length; i++) {
        var abName = aDoc.artboards[i].name;
        aDoc.artboards[i].name = (i + 1) + '_' + abName;
    }
}

artboardRef();

Likes

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 ,
Aug 02, 2022 Aug 02, 2022

Copy link to clipboard

Copied

Yes, Its working as expect. Thank you so much. 

Likes

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 ,
Aug 02, 2022 Aug 02, 2022

Copy link to clipboard

Copied

It will be great, if this script works only at selected artboards in the panel, is it possible ?

Likes

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 ,
Aug 02, 2022 Aug 02, 2022

Copy link to clipboard

Copied

No. Selected layers and artboards in panels are used by the user for manual movement, but this selection is not available to the API.

Likes

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 ,
Aug 03, 2022 Aug 03, 2022

Copy link to clipboard

Copied

LATEST

Its OK, but you solved my Big problem of Renaming Artboards 

Likes

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