Copy link to clipboard
Copied
Hello everyone, I have this script to convert multiple layers to multiple artboards, and also copy each layer name to artboards.
The problem is how to reserve the this script process?
I mean to converts artboards to layer and copy artboards name to layer. Thanks
#target illustrator
main();
function main() {
if ( app.documents.length == 0 ) { return; }
var doc = app.activeDocument;
doc.layers[0].hasSelectedArtwork = true;
doc.fitArtboardToSelectedArt( 0 );
doc.selection = null;
for ( var i = 1; i < doc.layers.length; i++ ) {
doc.artboards.add( [0,0,72,-72] );
doc.layers[i].hasSelectedArtwork = true;
doc.fitArtboardToSelectedArt( i );
doc.selection = null;
};
};
if (app.documents.length == 0) {
alert("No Open / Active Document Found");
} else {
var doc = app.activeDocument;
if (doc.artboards.length == doc.layers.length && doc.layers.length == doc.artboards.length) {
for (var i = 0, l = doc.artboards.length; i < l; i++) {
var ab = doc.artboards[i];
ab.name = doc.layers[i].name;
}
alert("Finished:\nRenaming of Artboards to match Layer names is complete");
} else {
alert("Opps: This wont work!\n The number of Layers and Artboards do not match");
}
}
Here you go.
function layersFromArtboards()
{
var docRef = app.activeDocument;
var layers = docRef.layers;
var aB = docRef.artboards;
//we will remove this layer after the others have been created.
var tempLay = layers[0];
tempLay.name = "Temp";
//loop the artboards
for(var x=0;x<aB.length;x++)
{
var thisAb = aB[x];
aB.setActiveArtboardIndex(x);
docRef.selectObjectsOnActiveArtboard();
var sel = docRef.selection;
...
Copy link to clipboard
Copied
Hello, could someone make this script into a download, I seem to lack the know-how of creating a javascript documento to run this script from the source code.
Thanks!
Copy link to clipboard
Copied
Copy and paste it in a jsx file. (You can create a txt file and change the extension to jsx.) Then, while your document is open in Illustrator, go to File > Scripts > Other Script (Ctrl+F12). Find your script and open it.
Copy link to clipboard
Copied
Hi dario, copy the script posted here, open a text editor and paste the copied text. Save the file as "pickAgoodName.jsx", save it as Plain text (not Rich Text Format) anywhere you can easily find it.
to run in illustrator go to, File->Scripts->Other Scripts... and browse to where you saved the file
Copy link to clipboard
Copied
Thank you so much Carlos. I will try it early next week. Much appreciated.