OS 9, Illustrator 10, Selecting Menu Items, and Color Modes

I am relatively new to coding AppleScripts, but I guess I have jumped in to something that I am fast realizing is a problem that may be unsolvable on this OS 9 system.

My problem is that I need to create a script that automates opening a couple hundred EPS files, convert them from RGB to CMYK (only accessible through a File → Color Mode → CMYK menu), run an action, save, and close.

I am sure that running actions is possible through scripting, I just haven’t been able to find how… but a bigger problem is accessing the colour mode. In OS X (with it’s ability to access “System Events”) it is a little easier it seems, but perhaps someone here knows a work-around.

I am able to do some of it pretty easily myself, based on running a script that works on all open documents, saving and closing. My problem is accessing Illustrator’s actions, and accessing a menu item that has no shortcut. Can anybody help me out?

P.S. This forum is great! I’ve learned more just reading through posts than I have in some of the books that have been passed to me.



Couldn’t you just do a save as setting the EPS Save options?

Here is an example from Page 69 of the Illustrator 9 scripting guide. You should be able to find something similar on your Illustrator 10 CD. I could not test it but I’d guess if you change "tell application “Adobe Illustrator® 9.0"” to "tell application “Adobe Illustrator® 10"” it would work?

Example 9.1
This handler processes a folder of Illustrator files, saving each as an EPS file with level 2
PostScript and Illustrator 9 compatibility. The files are save to the folder specified in the
destinationFolder parameter. Note that the class property is specified in the record to
ensure that Illustrator can determine the save option class.

 -- fileList is a list of aliases to Illustrator files
-- destinationFolder is an alias to a folder where the EPS files are to be saved
set sourceFolder to choose folder with prompt "Source folder?"
tell application "Finder" to
set fileList to every file of folder sourceFolder as alias list
set destinationFolder to choose folder with prompt "Destination folder?"
set destinationPath to destinationFolder as string
repeat with aFile in fileList
tell application "Finder" to set fileName to name of aFile
set newFilePath to destinationPath & fileName & ".EPS"
tell application "Adobe Illustrator® 9.0"
open aFile
save current document in file newFilePath as eps ¬
with options {class:EPS save options ¬
, compatibility:Illustrator 9 ¬
, preview:color Macintosh ¬
, embed linked files:true ¬
, include document thumbnails:true ¬
, embed all fonts:true ¬
, japanese file format:false ¬
, CMYK PostScript:true ¬
, PostScript:level 2}
close current document saving no
end tell
end repeat

Combine that with this do script component for the action and you should be good to go (p186).

-- This script executes an action in the default set without displaying any dialogs
tell application "Adobe Illustrator® 9.0"
do script "Opacity 40 Screen (selection)" from "Default Actions" without dialogs
end tell

Good luck,

Wow, thanks for the quick response.

Your post did help me out a lot, especially with running the action. I took a look at what your script was doing and just tried going through the motions in illustrator without compiling and I still have the same problem.

Saving with CMYK Postscript is fine and good, but it doesn’t change the actual color mode to CMYK. I have not been able to find a line of code that would allow me to do this which makes me wonder whether the function even has support. Sounds dumb since it’s such a simple command.

I’ll keep at it because a few hours of trying to find some code is better than the countless hours it would take to do this with all of the documents. Thanks again for the help, and I’m sure I will be using bits & pieces of your work in the future… If anyone else has any suggestions please let everyone know, I’m sure sooner or later someone will be in the same jam.



The one good thing about Adobe applications (and some others) is that you can set up your own customized shortcuts for most available functions. While I didn’t realize it at the time, the CMYK color mode option can be assigned a keyboard shortcut in this way.

All I really needed my script to do was take all the open illustrator documents, convert all type to outlines, convert to CMYK, save, and close. Since these are all things you I do repetitively using keyboard shortcuts, You can ignore Illustrator’s scripting dictionary entirely if you want to and just use a keyboard-input addition like Extra Suites.

For example:

tell application "Extra Suites"
ES type key "c" with command, option and shift -- the shortcut I created that would change the color mode to CMYK
end tell

I’m new to coding and I’m sure there’s other ways to do this, but this worked really easily and for a newbie I was pretty proud to automate the task of editing several hundred files without much worry.