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

Artboard name to Content

Community Beginner ,
Jun 27, 2023 Jun 27, 2023

Copy link to clipboard

Copied

I work with the script and it works very well. But I can only use one Active Artboard at a time. Can someone help me so that all artboard names are automatically written into the content

1000 Thanks


#target illustrator
function test(){
    if (app.documents.length == 0) {
        return;
    }
    var doc = app.activeDocument;
    var newText = doc.activeLayer.textFrames.add();
    var idx = doc.artboards.getActiveArtboardIndex();
    var currentArtboard = doc.artboards[idx];
    newText.contents = currentArtboard.name;
    newText.top = currentArtboard.artboardRect[1] + 10;
    newText.left = currentArtboard.artboardRect[0] + 10;
    newText.textRange.characterAttributes.size = 20;
};
test();

 

 

 

TOPICS
Scripting

Views

301

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

Community Expert , Jun 27, 2023 Jun 27, 2023

Hi,

Try following version

#target illustrator
function test() {
    if (app.documents.length == 0) {
        return;
    }
    var doc = app.activeDocument;
    for (var a = 0; a < doc.artboards.length; a++) {
        var newText = doc.activeLayer.textFrames.add();
        var currentArtboard = doc.artboards[a];
        newText.contents = currentArtboard.name;
        newText.top = currentArtboard.artboardRect[1] + 10;
        newText.left = currentArtboard.artboardRect[0] + 10;
        newText.
...

Votes

Translate

Translate
Adobe
Community Expert ,
Jun 27, 2023 Jun 27, 2023

Copy link to clipboard

Copied

Hi,

Try following version

#target illustrator
function test() {
    if (app.documents.length == 0) {
        return;
    }
    var doc = app.activeDocument;
    for (var a = 0; a < doc.artboards.length; a++) {
        var newText = doc.activeLayer.textFrames.add();
        var currentArtboard = doc.artboards[a];
        newText.contents = currentArtboard.name;
        newText.top = currentArtboard.artboardRect[1] + 10;
        newText.left = currentArtboard.artboardRect[0] + 10;
        newText.textRange.characterAttributes.size = 20;
    }
};
test();
Best regards

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 Beginner ,
Jun 27, 2023 Jun 27, 2023

Copy link to clipboard

Copied

LATEST

Wow, it works really really good Thank you. Happy Happy day

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