Slight niggle with Illustrator Script...

Hi there,

Hopefully someone might be able to point me in the right direction with this.

When trying to open a file in Illustrator I’m coming up with this error:-

The rest of script works ok, here’s how I’m trying to select a folder an process each pdf in it:-

tell application "Finder"
	set yy to choose folder with prompt "Choose a folder or volume:"
	set theItems to every file of yy
end tell


repeat with thisItem in theItems

	tell application "Adobe Illustrator"
		activate
		open file thisItem without dialogs    << ERROR OCCURS HERE

-- PROCESS THE FILE

end tell
end repeat

Please can anyone point me in the right direction?

Thanks in advance,

Nick

Hi,

the error message says: Can’t make a Finder file specifier into an alias.
So you have to do it


.
open (thisItem as alias) without dialogs
.

Hi, Nick.

Illustrator doesn’t understand the Finder references. You need to change them to aliases:

tell application "Finder"
	set yy to choose folder with prompt "Choose a folder or volume:"
	try -- In case this is running on a pre-SL system.
		set theItems to (every file of yy) as alias list
	on error -- Only one file present.
		set theItems to (first file of yy) as alias as list
	end try
end tell

-- etc.

Hi Guys,

Thanks for the speedy help, it solved the problem :slight_smile:
Need to bear that in mind next time.

Just trying to workout why Illustrator is ignoring the ‘without dialogs’ part of the Open?
It’s asking for missing fonts :confused:

All good fun for a Tuesday morning :slight_smile:

Thanks once again for the help.

Regards,

Nick

does adding ‘set user interaction level to never interact’ resolve this?

tell application "Adobe Illustrator"
	set user interaction level to never interact
	-- open file here
end tell

Hi Mark,

Thanks for that, absolutely spot-on.
Works a treat.

Noticed that in the library however I think I wasn’t using it correctly.

Thanks again.

Regards,

Nick