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

is there way to Place artboard name at respective text layer by script?

Engaged ,
Sep 05, 2023 Sep 05, 2023

Hello Friends,

I am into makeing many ID cards, and I renamed all Artobards based on Placed pictures on it. all the Artbords name I want to place at repective text layer(which have its own text style) on each resepective artboard

 

jkhakase_0-1693920107999.png

 

TOPICS
Scripting
476
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

Enthusiast , Sep 06, 2023 Sep 06, 2023

Then you need to give the text frame a unique name so that the script can find it.

main();

function main() {
  var tfName = 'name'; // Your text frame name
  if (!documents.length) return;
  var doc = app.activeDocument;
  for (var i = 0, len = doc.artboards.length; i < len; i++) {
    doc.artboards.setActiveArtboardIndex(i);
    replaceTextFrame(doc.artboards[i], tfName);
  }
}

function replaceTextFrame(ab, tfName) {
  app.activeDocument.selectObjectsOnActiveArtboard();
  for (var i = 0, len =
...
Translate
Adobe
Enthusiast ,
Sep 06, 2023 Sep 06, 2023

Not all the details are clear from the screenshot. You have artboards that already have names and you want to replace Name Surname with the name of the artboard? Does the artboard have other text frames, or does the artboard contain a single text frame that needs to be replaced?

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
Engaged ,
Sep 06, 2023 Sep 06, 2023

Each artboards can have multiple text frames, but I want showcase artboard names at only selected resepective text field, where I can apply my custom text style to define their look

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 ,
Sep 06, 2023 Sep 06, 2023

Then you need to give the text frame a unique name so that the script can find it.

main();

function main() {
  var tfName = 'name'; // Your text frame name
  if (!documents.length) return;
  var doc = app.activeDocument;
  for (var i = 0, len = doc.artboards.length; i < len; i++) {
    doc.artboards.setActiveArtboardIndex(i);
    replaceTextFrame(doc.artboards[i], tfName);
  }
}

function replaceTextFrame(ab, tfName) {
  app.activeDocument.selectObjectsOnActiveArtboard();
  for (var i = 0, len = app.selection.length; i < len; i++) {
    var item = app.selection[i];
    if (item.name === tfName && item.typename === 'TextFrame') {
      item.contents = ab.name;
    }
  }
  app.selection = null;
}

2023-09-07 09.59.23.gif 

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 ,
Sep 06, 2023 Sep 06, 2023

This is a thread about Adobe Illustrator. OP is working with artboards in AI.

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
Engaged ,
Sep 07, 2023 Sep 07, 2023
LATEST

Perfect!, Thank you so much @Sergey Osokin I was looking the same. you saved my many clicks.

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