The closing of documents is a fundamental action performed by scripts, and is accomplished using the close command from the Standard Suite.
close v : Close a document.
close specifier : the document(s) or window(s) to close.
[ saving yes/no/ask ] : Should changes be saved before closing?
[ saving in file ] : The file in which to save the document, if so.
The close command has two optional parameters that determine: 1) whether changes made to the document should be saved before it is closed; and 2) in which file the document should be saved.
The example scripts provided below, demonstrate typical uses of the close command:
|Close All Documents|
|01||tell application "Numbers"|
|03||close every document without saving|
The following script examines all open documents, closing those which have not yet been saved to file: