Copy link to clipboard
Copied
Years ago I had been working on a Script for Illustrator project to place the File's Name (minus the extension) within the artboard. I passed the project off and now no longer have the same computer so that solution was lost. Is that something that someone can help me with?
Thank you for your time and consideration,
Hi,
Could you try this one. This is a really. basic just to get an idea that you are looking for the same. Following script assume there is one file on your desktop with name "Test".
var doc = app.activeDocument;
var file = File('~/Desktop/Test.png')
var fileName = file.name.split('.')[0];
var textFrame = doc.textFrames.add();
textFrame.contents = fileName;
app.executeMenuCommand('Fit Artboard to artwork bounds');
It may possible your original script have more handling of size of the text, fon
...Oh,
a bit to late.
😉
addArtboardName();
function addArtboardName() {
var aDoc = app.activeDocument;
var aDocName = aDoc.name;
if (aDoc.artboards.length == 1) {
var aDocName = aDoc.name.replace(/\..{2,5}$/, "");
var Bds = aDoc.artboards[0].artboardRect;
var aTF = aDoc.textFrames.pointText([Bds[2],Bds[3]]);
aTF.contents = aDocName;
aTF.translate(-aTF.width);
}
}
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Hi,
not exactly what you want - but a good base:
Script to rename artboard to filename
Please describe a bit more in detail - how many artboards, which position for the textframe and so on …
Copy link to clipboard
Copied
Hi,
Could you try this one. This is a really. basic just to get an idea that you are looking for the same. Following script assume there is one file on your desktop with name "Test".
var doc = app.activeDocument;
var file = File('~/Desktop/Test.png')
var fileName = file.name.split('.')[0];
var textFrame = doc.textFrames.add();
textFrame.contents = fileName;
app.executeMenuCommand('Fit Artboard to artwork bounds');
It may possible your original script have more handling of size of the text, fonts and anything else.
Copy link to clipboard
Copied
Oh,
a bit to late.
😉
addArtboardName();
function addArtboardName() {
var aDoc = app.activeDocument;
var aDocName = aDoc.name;
if (aDoc.artboards.length == 1) {
var aDocName = aDoc.name.replace(/\..{2,5}$/, "");
var Bds = aDoc.artboards[0].artboardRect;
var aTF = aDoc.textFrames.pointText([Bds[2],Bds[3]]);
aTF.contents = aDocName;
aTF.translate(-aTF.width);
}
}
Copy link to clipboard
Copied
Not at all. Just 20 minutes.. 😉 🙂
Copy link to clipboard
Copied
😉
Es ist eher wie im Sandkasten zu spielen als in einem Duell.
It's more like playing in a sandbox than a duel.
Copy link to clipboard
Copied
A bit late too in writing an English version.
But translation feature saves me in understanding.. 🙂