Re: Illustrator CS 3 'open' command sometimes throws error 8700
Re: Illustrator CS 3 'open' command sometimes throws error 8700
- Subject: Re: Illustrator CS 3 'open' command sometimes throws error 8700
- From: Simon Topliss <email@hidden>
- Date: Fri, 25 Sep 2009 15:55:48 +0100
On 25 Sep 2009, at 15:41, Hamish Sanderson wrote:
Simon Topliss wrote:
*The above is actually required in Snow Leopard. "open alias
filePathAsString" will always error in SL.*
Not here it isn't. Are you sure you're not mixing it up with the
problem of
making file references on the fly?
Nope, definitely errors here, just checked again. Try running the
following:
set f to (path to desktop as text) & "Yellowstone Map.ai"
tell application "Adobe Illustrator"
open alias f
--open (f as alias) -- Works
end tell
I get "AppleScript Runtime Error: Adobe Illustrator got an error:
Can?t make some data into the expected type. -1700."
Apple changed the way that alias specifiers are evaluated in 10.5.
IIRC, if you write a literal alias specifier as a command parameter,
e.g. 'open alias ...', the alias specifier is not evaluated to an
alias object before being sent to the application. This ties in with
the whole business of how and when AS decides to evaluate reference
literals. Prior to 10.5, alias literals were always evaluated at
compile-time; in 10.5+, they are evaluated at run-time, so are
subject to the standard rules that AS uses to decide if it should do
an implicit 'get' or not.
I'd need to investigate further to be sure, but I suspect AI's open
command requires an alias object and doesn't know how to convert an
alias specifier into an alias object for itself; hence the error
from Illustrator.
Using an alias coercion (as in your commented-out line) instead of
an alias specifier will guarantee you have an alias object. I do
seem to recall from 10.4 days that coercing text to alias and/or
POSIX file would sometimes fail on strings containing non-ASCII
characters, but given AS's text system has been heavily reworked
since then I would hope these coercions work just as well as using
alias and POSIX file specifiers.
Not an issue in my code (I know my open event's direct parameter is
an AEDesc of typeAlias, not typeObjectSpecifier), but maybe useful
to others.
I'm not sure it goes back to Leopard. The "open alias f" version only
fails for me in Snow Leopard. It's part of a library that's used 100s
of times a day since way back.
Simon
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden