photo credit: pasukaru76 via photopin cc

Use AppleScript to perform batch actions in Illustrator

As some of you might know Illustrator doesn’t have the handy batch-options that PhotoShop has. So if you have a bunch of Illustrator files and you want to perform an action on all of them, you’re stuck with opening them one by one…
Well, as I mentioned in my previous article, you can create macro’s for any given program with AppleScript. So why not use this handy feature to perform batch actions in Illustrator? In this article, I’ll explain how you can use AppleScript to do just this.

Opening the Illustrator files in a batch

Well, the first thing we need to do of course, is get a list of files we would like to open. Let’s say we want to perform a batch action on a folder containing Illustrator files. In AppleScript you can create a list with files like so:

Now we can perform a simple repeat -loop on this list in which we can perform our action:

Performing one or more actions

We now have a basic skeleton of our Illustrator batch function. Now it’s time to actually execute an action prior for saving. In the above code, replace the comment # Perform one or more action here  with something like this:

Where of course you put the name of your own action you wish to perform. Of course, since it’s a script, there is no limit to the number of actions you can put here. So you’re not limited to one action.

More than just actions

AppleScript isn’t restricted to just actions. There is a lot of other Illustrator stuff you can put here. For example, the following code unlocks all layers and page items in Illustrator:

It’s also possible to select an item (for example, when for your action a specific element needs to be selected):

And that’s just a small fragment of what’s possible. If you want to know all possibilities, I would suggest you take a look at Adobe’s AppleScript scripting reference guide for AppleScript.

Wrap it all up

To wrap it all up, you now have an AppleScript that looks something like this:

And that’s it! This little script can be your timesaver for some of your bigger Illustrator projects. Just imagine you relaxing and drinking coffee while you let your Mac crunch those numbers for you. Your co-workers won’t know what hit them! You’ll be the coolest kid on the block!

Visitors give this article an average rating of 4.6 out of 5.

How would you rate this article?

One thought on “Use AppleScript to perform batch actions in Illustrator”

  1. K Selvaraj says:

    I would like create a script so that it performs the following

    I should open a file and unlock all layer, delete any hidden layers, select all and convert to outlines. Now i should execute the package in the file menu and save the file, both as ai and pdf.

    Can you please help me out.

Leave a Reply to K Selvaraj Cancel reply