Handles the close
AppleScript command by attempting to close the window (and its associated document, if any).
SDK
- macOS 10.0+
Framework
- App
Kit
Declaration
func handleClose(_ command: NSClose Command) -> Any?
Discussion
Extracts close
command arguments from the command
object and uses them to determine how to close the associated document—specifically, whether to ignore unsaved changes, save changes automatically, or ask the user and to identify the file in which to save the document (by default, the file that was opened or previously saved to, or an “untitled” name if the file has never been saved).
If there is a corresponding document and the window is the main window of the document, it forwards the close
command to the corresponding document; otherwise, the window sends itself a perform
message, if it has a close box. This may have been handled differently in versions of macOS prior to version 10.3.