Re: Applescript crashing Adobe Illustrator
Re: Applescript crashing Adobe Illustrator
- Subject: Re: Applescript crashing Adobe Illustrator
- From: Stan Cleveland <email@hidden>
- Date: Wed, 05 May 2010 13:34:14 -0700
- Thread-topic: Applescript crashing Adobe Illustrator
Title: Re: Applescript crashing Adobe Illustrator
On 5/5/10 12:13 PM, "Jim Skibbie" wrote:
I’m working on an Applescript for Adobe Illustrator. When the script runs, it causes Illustrator to crash with the error:
Adobe Illustrator got an error: Connection is invalid. Error –609.
Here’s the portion of the script that causes the crash. This code works for some files and for other files, it crashes Illustrator.
Any ideas?
set LayersToSave to {"Names", "Of", "Specific", "Layers"}
tell application "Adobe Illustrator"
set AIDoc to current document
set theLayers to every layer of AIDoc
end tell
repeat with j from (count of theLayers) to 1 by -1
set theName to name of item j of theLayers
if LayersToSave does not contain theName then my RemoveThisLayerFromFile(theName, AIDoc)
end repeat
on RemoveThisLayerFromFile(LayerName, doc)
tell application "Adobe Illustrator"
if (exists layer LayerName of doc) then
delete layer LayerName of doc
end if
end tell
end RemoveThisLayerFromFile
Hi Jim,
The message “connection is invalid” is AS’s way of telling you that the application is no longer responding—that is, it has crashed. On my Mac, your code does not crash Illustrator CS3, though I’ve managed many times to crash InDesign CS3 and CS4 with my own AS code. Addressing a non-existent item or property is the usual culprit. Have you determined exactly which command is killing Illustrator?
Also, I’ve encountered InDesign document files that have gotten internally corrupted somehow and will cause the application to crash. My attempts to resave or copy-and-paste-to-a-new-document never seems to fix them—they must be rebuilt from scratch. Perhaps Illustrator files can get corrupted, too, and might cause Illustrator to barf on them.
One more thought. There are cases where an application’s preference files can also get corrupted. Dumping them, thus forcing them to be re-created, can cure a tendency for the application to crash. It’s some effort to redefine your settings, but it might be worth a try.
HTH,
Stan C.
_______________________________________________
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