Open File in Illustrator CS
Open File in Illustrator CS
- Subject: Open File in Illustrator CS
- From: email@hidden
- Date: Fri, 14 Oct 2005 11:24:53 -0500
- Priority: normal
Hi,
What I'm needing to do is open an Illustrator file. It sounds easy
enough but there's all sorts of error dialogs that can appear.
Originally I was just going to turn them off but there's some I need to
know about so that I can place the job in an error queue for the user
to fix. By the way, I'm using Illustrator CS (we can't use Illustrator
CS2 at the moment because it's not yet working with Font Reserve).
When the script was originally written (in AppleScript), the programmer
used GUI scripting to click the buttons he needed. For example:
--
tell application "System Events"
tell application process "Illustrator CS"
repeat
if exists window 1 then
if (exists button "Update" of window 1) and (exists button "OK" of
window 1) then
keystroke return
delay 5
exit repeat
end if
if ((exists button "cancel" of window 1) and (exists button
"Ignore" of window 1) and (exists button "replace" of window 1)) then
set errorType to "LINKED"
keystroke "." using command down
delay 5
exit repeat
end if
end if
end repeat
end tell
end tell
--
It works most of the time, but not always. But at least you know what
errors the file has (like substituted fonts, missing links, etc.). I
saw in the Illustrator Dictionary that you can get by some of the
dialogs by using commands like 'forcing CMYK', etc. So I tested this
code in AppleScript:
--
set f to "Macintosh HD:Users:jyoung1:Desktop:optix test
file:COM.FS.legacy.SE1195"
tell application "Illustrator CS"
open file f forcing CMYK with options {update legacy text:false}
end tell
--
But instead of openning the file, it brings up an Open File Dialog
window where I have to select the file manually!
So I decided to try and use JavaScript to get around this problem. I
figured out this code last night (I run it in an AppleScript):
--
set f to "Macintosh HD:Users:jyoung1:Desktop:optix test
file:COM.FS.legacy.SE1195"
tell application "Illustrator CS"
try
with timeout of 10 seconds
do javascript "
var optRef = new OpenOptions();
optRef.updateLegacyText = false;
var x = new File(\"" & f & "\", DocumentColorSpace.CMYK, optRef);
open(x);"
end timeout
on error Err
return Err
end try
end tell
--
This code works much better, but there is one problem. If the file is
missing a font it would normally bring up a Font Substitution window.
This code just opens the file without ever bringing up that dialog. Is
there a way to look for the fonts that are missing (I believe they
could be embedded in a linked image as well)? We use Font Reserve
which activates the approrpriate fonts when needed, but every now and
then someone uses a font that we don't have.
I haven't looked into getting around the 'missing linked files' dialog
yet, but that's my next step. I'm starting to think that I'll probably
have to continue using the old code so I can make sure I trap all the
appropriate errors. But if you have any thoughts I'd love to hear
them.
Thanks.
Jay
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden