Quit after last window closed

I’m trying to get my applescript app to quit when I close the window.


on clicked theObject
	<alot of crap>

end clicked

on should quit after last window closed theObject
	return true
end should quit after last window closed

I added the bottom code hoping it would quit my app when window is closed. But it does not do anything.

Anyone? :confused:

Morning,

You also need to connect the handler should quit after last window closed of the Application and File’s Owner to your main script file (or the one that has the code you mentionned) for it to work.

Connections are often the source of such bugs, i.e. when nothing happens where you expected something to. You should check there first before anything else. :slight_smile:

Browser: Safari 531.9
Operating System: Mac OS X (10.6)

Additionally I recommend to first make the connections in Interface Builder.
If the connection is successful, the code of the handler will be inserted automatically in the script.

That is true. You probably typed it in your code expecting it was enough to make it work… it’s not enough, sadly! :wink:

Browser: Safari 531.9
Operating System: Mac OS X (10.6)

ah, of course… makes much sense :smiley:
now it works :D:D thanks :slight_smile: