How can I use AppleScriptObjC to close my Xcode application?

Hello!

I'm writing an AppleScriptObjC application in Xcode and am trying to figure out how to make it close itself programmatically. I can't use errors, they don't work like in pure applescript apps, I can't use "tell application \"MyApp\" to quit", because Xcode doesn't allow that; I am stuck!
I've search high and low across the internet, and came up with nothing. Any help would be appreciate greatly!

Xcode-OTHER, OS X Mountain Lion (10.8.2)

Posted on Mar 9, 2013 8:00 PM

Reply
2 replies

Mar 9, 2013 9:16 PM in response to russellsayshi

More specifically, the applicationShouldTerminate: delegate method is called after the Quit menu item is selected or the terminate: method is called to determine if the application should quit. Normally you would return the constant NSTerminateNow, e.g.



on applicationShouldTerminate_(sender)

# perform any cleanup stuff

return current application's NSTerminateNow


end applicationShouldTerminate_


See the NSApplicationDelegate Protocol Reference for more information.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How can I use AppleScriptObjC to close my Xcode application?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.