Skip to main content
Inspiring
February 9, 2020
Answered

Load Files into Stack... for Illustrator

  • February 9, 2020
  • 2 replies
  • 2137 views

In Photoshop there is the built-in script called "Load files into Stack...". Is there automated way of doing the same thing in Illustrator?

 

Just like in the default Photoshop script I'd like to take a bunch of Illustrator files, have a script/tool drop the art from each individual Illustrator file onto its own layer in one Illustrator file and rename the layer using the file name where it pulled the art.

 

I'm not looking for solutions where it puts each file on its own artboard. This query is for placing multiple files each on their own layer in one Illustrator file and renaming the layers to match their source .ai file.

 

Yes, copy/paste and manually renaming will work. But I'm looking for an automated function. Maybe this ends up being a question of how do I build such a script.

 

Thank you

This topic has been closed for replies.
Correct answer ErikMaldre

yea. I was trying to answer your question, "how do I build such a script".

 

If you'd like the whole thing written for you that could absolutely be arranged.. But I stated at the beginning of my response that what was to follow was pseudo code. the fact that it worked at all is frankly a miracle because i was merely showing how to do each basic task you wanted.


Ah. yes. Well, I think this post demonstrates my complete lack of coding knowledge. I assumed "pseduo code" was some kind of techical jargon that was part of the code. ***insert facepalm***

 

And I should have more clearly stated my request in the post. In retrospect, yes, I asked how I would go about coding a solution and your reply provided an answer.

 

Fortunately, a solution has been provided offline that answers the intent of my post.

http://kelsocartography.com/blog/?p=2047

2 replies

Disposition_Dev
Legend
February 10, 2020

something like this?

 

pseudo code:

var mainDoc = app.activeDocument;
var sourceDoc = app.documents[1];

sourceDoc.activate();
sourceDoc.layers[0].hasSelectedArtwork = true;
app.executeMenuCommand("group");
var tempGroup = sourceDoc.groupItems[0];
var newLayerName = sourceDoc.layers[0].name;
tempGroup = tempGroup.duplicate(mainDoc);

mainDoc.activate();
var destLayer = mainDoc.layers.add();
destLayer.name = newLayerName;
destLayer.zOrder(ZOrderMethod.SENDTOBACK);
tempGroup.moveToBeginning(destLayer);
mainDoc.selection = null;
tempGroup.selected = true;
app.executeMenuCommand("ungroup");
Inspiring
February 12, 2020

Thanks williamdowling. I had a friend who knows a bit javascript look at this code. Here's what he said:

I opened seven Illustrator files. I pulled up the second file to be in the front. I ran the script. It copied the first Illustrator file, and pasted it into the second document (in a new layer). It did not rename the layer
It did not copy the other five open Illustrator files.
It looks like there's no loop in the code. It needs a loop.

ErikMaldreAuthorCorrect answer
Inspiring
February 12, 2020

yea. I was trying to answer your question, "how do I build such a script".

 

If you'd like the whole thing written for you that could absolutely be arranged.. But I stated at the beginning of my response that what was to follow was pseudo code. the fact that it worked at all is frankly a miracle because i was merely showing how to do each basic task you wanted.


Ah. yes. Well, I think this post demonstrates my complete lack of coding knowledge. I assumed "pseduo code" was some kind of techical jargon that was part of the code. ***insert facepalm***

 

And I should have more clearly stated my request in the post. In retrospect, yes, I asked how I would go about coding a solution and your reply provided an answer.

 

Fortunately, a solution has been provided offline that answers the intent of my post.

http://kelsocartography.com/blog/?p=2047

pixxxelschubser
Community Expert
Community Expert
February 9, 2020

Every single AI file has only one top level layer (for doing the same like the PS script) ?

And the artboard size is the same ?

Inspiring
February 9, 2020

Thanks for the questions pixxel_schubser. All the artboards are the same size. Each of the ai files have only one layer.