Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How to terminate an app when last window closed?

it is driving me nuts, i am doing an xcode projetct: an

applescript cocoa application.

so far so good, but:


how can i terminate the application, when the last window

is closed??


i have read anything about ApplicationShouldTerminate...... methods

and any obj C method that could have something to do with this topic,

but how can i do this operation in an applescript application?


thanks

Derand

Applescript-OTHER, Mac OS X (10.7.2)

Posted on Mar 29, 2012 1:00 PM

Reply
Question marked as Best reply

Posted on Mar 29, 2012 6:09 PM

There are several application delegate methods that can be added your AppDelegate.applescript (see NSApplicationDelegate Protocol Reference) - the one you are looking for is applicationShouldTerminateAfterLastWindowClosed:, for example


on applicationShouldTerminateAfterLastWindowClosed_(sender)

returntrue

end applicationShouldTerminateAfterLastWindowClosed_

3 replies
Question marked as Best reply

Mar 29, 2012 6:09 PM in response to DERand

There are several application delegate methods that can be added your AppDelegate.applescript (see NSApplicationDelegate Protocol Reference) - the one you are looking for is applicationShouldTerminateAfterLastWindowClosed:, for example


on applicationShouldTerminateAfterLastWindowClosed_(sender)

returntrue

end applicationShouldTerminateAfterLastWindowClosed_

How to terminate an app when last window closed?

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