I'm looking for a keyboard shortcut to close a window of an app, skipping the "Would you like to save" pester dialog, while leaving the app, itself, and other windows, still open.
If there's no way to do that, is there a keyboard shortcut for hitting a certain button in a window/dialog? In Windows, this would typically be ALT+[first letter of the button text].
Best Answer
To press a button in a dialog using a keyboard shortcut, press Command, followed by the first letter of the action you wish to trigger. The exception to this rule is if the action you wish to activate will delete a file or changes thereto, in which case the shortcut is Command-delete.
To force-close a window, you'd need to automate the correct series of key presses using AppleScript or something similar. The first key combination would likely be Command-W (though not even this is entirely universal). However, the dialog shortcuts vary by application—older versions of Microsoft Word don't comply with the Command-delete behavior (they use Command-D), while Automator's save sheets can often only be closed through mouse input. You would have to tailor this behavior to the specific applications in which you're interested. Such an AppleScript might look something like this (though be warned, triggering Command-delete without knowing the context is an easy way to accidentally delete files and large swathes of text):
To tie an AppleScript to a keyboard shortcut:
You could create multiple services, each one with the same keyboard shortcut but in different applications, corresponding to the unique behavior of each.