This page is a wiki. Please login or create an account to begin editing.


7 posts / 0 new
Last post
Offline
Joined: 2011 Jul 21
AppleScript Help

I have several thousand EPS files that don't include embedded thumbnails. I've found that if I open each file in Adobe Illustrator and save the file, the thumbnail is added to the EPS file.

I'd like to add these thumbnails to the files so I figured I could use AppleScript to to the job.

I put the following script together from from google research:

tell application "Finder"
set folderSource to choose folder with prompt "Choose files for saving in mac compactable."
set fileList to every file of folder folderSource as alias list
set folderDest to choose folder with prompt "Choose folder destination."
set destPath to folderDest as string
set fileCount to count folder folderSource
repeat with aFile in fileList
set fileName to name of aFile
set newFilePath to destPath & fileName
tell application "Adobe Illustrator 10"
activate
open aFile
save current document in file newFilePath as eps with options {class:EPS save options, preview:color Macintosh, embed linked files:true, include document thumbnails:true, embed all fonts:true, CMYK PostScript:true, PostScript:level 2} with replacing
close current document saving no
end tell
end repeat
end tell

The problem I've encountered occurs on the line:
tell application "Adobe Illustrator 10"

When I try to "Run" the script I get a syntax error on this line to wit:
File some object wasn't found

I've tried several variations of the line but the error persists. Is Finder unable to locate Illustrator or what?

Gary

Comments

MikeTomTom's picture
Offline
Joined: 2009 Dec 7

Do you mean without embedded thumbnails or missing Macintosh Pict Previews (preview:color Macintosh) in the eps files? Is this script for OS 9.x?

Anyway shouldn't there be an "end tell" before the tell application "Adobe Illustrator 10" statement? Otherwise you're asking application "Finder" to tell Adobe AI to activate, where you should be getting AppleScript to "tell" applications (including the Finder) to do something. Its unclear who you're try to get to open "aFile" at this point.

Offline
Joined: 2011 Jul 21

>Do you mean without embedded thumbnails or missing Macintosh Pict Previews (preview:color Macintosh) in the eps files?

Probably the latter (PICT Previews) but I'm not certain. I'm creating a catalog using iView Media Pro as an aid to visualize the files. I'm not sure just what it is using as the catalog image.

Is this script for OS 9.x?

Yes.

>Anyway shouldn't there be an "end tell"

If you say so. I'll give that a try.

Gary

MikeTomTom's picture
Offline
Joined: 2009 Dec 7

Anyway shouldn't there be an "end tell"

I was totally wrong with my "helpful" misinformation there. I am sorry to say.

Good news; I tested out your script on Mac OS 9.2.2 with Illustrator 10 installed and on a bunch of .eps files without PICT previews in place and I can report that the script you provided works as is - without modification.

Bad news; As it appears to work OK for me, there must be something (perhaps you are doing) at your end causing it to fail.

I cannot replicate the error. It does hiccup if the .eps contains embedded fonts that are not installed on your system, but otherwise it works as you would want it to, ie; batch convert a folder of .eps without PICT previews to a folder of .eps files with PICT preview.

Offline
Joined: 2011 Jul 21

> there must be something (perhaps you are doing) at your end causing it to fail.

Maybe
tell application "Adobe Illustrator 10"
where "Adobe Illustrator 10" is the file name itself. But it is located on a rather lengthy path of folders NOT on the startup disk.

According to the AppleScript info I have, the application name does NOT need anything more than I have in the string.

But is that actually correct given the app itself is NOT in the Applications folder on the startup disk?

Gary

Offline
Joined: 2011 Jul 21

Well I deleted the script and created it again. This time, I also was able to run it successfully. So I turned it loose on a folder of 81 EPS files. SUCCESS!!!

I then tried a folder with 661 EPS files in it. BOO! It failed with an "Out of Memory" error on the line:
set fileList to every file of folder folderSource as alias list
with "alias list" highlighted.

I increased the memory allocation of the Script Editor but that did nothing. Since Finder is the parent application at this point in the Script, I made the assumption that I need to increase Finder's memory allocation. But the OS controls Finder's memory. I have no control over Finder memory.

How can I fix the error?

Gary

MikeTomTom's picture
Offline
Joined: 2009 Dec 7

Likely it would be Illustrators memory you'd need to increase, as its the one doing all the hard work. You could also break down large groups of .eps into smaller lots.

[edit] You could also tell Illustrator to Quit (after the end repeat) to flush its memory.