Illustrator script

I’m new to applescript and I would like to create an illustrator script that process all files in a folder.

I have a script that automatically selects all files in a folder. Now I would like to open all selected files in Illustrator. "

But I get an error cannot open selected files".


tell application "Finder" to select (every item in folder "Graphics" of folder
"Desktop" of folder "John" of folder "Users" of startup disk whose name
contains ".eps")
tell application "Illustrator CS"
	set mysel to selection
	repeat with asel in mysel
		set i to i + 1
		set thesel to item i of mysel as text
		set myunix to POSIX path of thesel
	end repeat
end tell

I’m using OSX 10.3.9 and Illustrator CS

Browser: Firefox 1.0.3
Operating System: Mac OS X (10.4)

A couple of things…

If you have a list of files with default applications, you may be able to just ask the finder to open them, or you can tell an application to open them.

If you have a list of files, you can repeat through them and use the iterator to address each file.


   repeat with asel in mysel
       open asel
   end repeat

Write back if you still can’t get it and we’ll help. I’m on a PC right now so I can’t code.

Thanks, for the replay…Like I said I’m new to applescript so this might be simple problem…

Could you please provide an illustrator CS example?

The eps files have generic icons which are not associated with Illustrator(graphics are ftp’d from another machine). Which is why I specifiy illustrator. If there is a way around this please let me know.?

I did try and use your suggestion…however I got this error message. “NSReceiverEvaluationScriptError: 5” (I’m not sure what I did wrong)?



tell application "Finder" to select (every item in folder "private:var:root:Desktop:Graphics:" of startup disk whose name contains ".eps")

set mysel to selection

repeat with asel in mysel
	open asel
end repeat


Browser: Netscape/7.2
Operating System: Mac OS X (10.4)