14

Whenever I try to quit an application using AppleScript I get the following error

An error of type -9874 has occurred.

The AppleScript command which I am using is

tell application "app_name" quit end tell 

1 Answer 1

32

Are you sure that "app_name" exists ? If it does exist, are you sure that it knows how to respond to AppleEvents (is "AppleEvent-aware") ? Try the following test - launch Activity Monitor (in /Applications/Utilities) and run this script:

tell application "Activity Monitor" quit end tell 

This works fine for me - if it works OK for you then the problem is probably with your specific application. If it doesn't work for you then you have some kind of system-related problem - try it on a different Mac to verify ?

Sign up to request clarification or add additional context in comments.

3 Comments

Does the basic commands such as open, quit work for an application which is not scriptable?
All apps are supposed to respond to the four required core AppleEvents, but there are no guarantees, at least for Carbon apps, where explicit code is needed to handle even these four events. I'm not sure about Cocoa apps - it may be the there is some default handling built into Cocoa which makes all Cocoa apps at least aware of these events.
slightly shorter: tell application "Activity Monitor" to quit"

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.