Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Activate the Don't Save button in Lion from the keyboard using AppleScript System 10.7
I miss the ability to press Command-D key to trigger the Don't Save button when closing documents. So, I wrote the following short Applescript to regain that functionality.

Paste the following script into AppleScript Editor and save it somewhere. Then use QuickSilver, Fastscripts or some other keyboard shortcut utility to trigger this Applescript. I set Control-Option-Command-D to be my shortcut. I can now trigger Don't Save with a keyboard shortcut.

tell application "System Events"
  set frontApp to name of the first process whose frontmost is true
  set focused of (button 3 of sheet 1 of front window of process frontApp) to 1
  tell application "System Events" to keystroke space
end tell
[kirkmc adds: A previous hint offered a different AppleScript, and the comments include a Terminal command to turn this functionality back on, if you prefer.]
    •    
  • Currently 4.13 / 5
  You rated: 5 / 5 (8 votes cast)
 
[6,281 views]  

Activate the Don't Save button in Lion from the keyboard using AppleScript | 17 comments | Create New Account
Click here to return to the 'Activate the Don't Save button in Lion from the keyboard using AppleScript' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Activate the Don't Save button in Lion from the keyboard using AppleScript
Authored by: arcticmac on Mar 16, '12 07:46:59AM

you know that cmd-delete now has that function in that dialog, right?



[ Reply to This | # ]
Activate the Don't Save button in Lion from the keyboard using AppleScript
Authored by: DougAdams on Mar 16, '12 07:49:17AM

The shortcut for "Don't Save" has been changed to Command-Delete. Or perhaps you just prefer not to use that?

---
dougscripts.com



[ Reply to This | # ]
Activate the Don't Save button in Lion from the keyboard using AppleScript
Authored by: baltwo on Mar 19, '12 06:23:39PM

That's the issue. Mouse with right hand, keyboard shortcuts with left hand is now not possible w/o dropping the mouse to get to the delete key; thereby, compromising my productivity. Apple could have used something else to enact the Desktop, leaving the decades-old CMD+first letter of all clickable buttons enabled. BTW, in the Finder on the Desktop, CMD+D does nothing. In Finder windows, with nothing selected, CMD+D does nothing; with something selected, CMD+D duplicates (i.e., copies) the selected items. None of those matter, since we're discussion closing documents not user-saved.



[ Reply to This | # ]
Activate the Don't Save button in Lion from the keyboard using AppleScript
Authored by: anw03 on Mar 16, '12 01:20:46PM

The Applescript is a very welcome and useful recovery of a very intutive and productive keyboard option I used countless times with a wide range of documents and draft files. The above reader "suggestions" are not relevant to me: the fact that Apple decided in its infinite and arbitrary wisdom to change a perfectly good and intuitive keyboard shortcut "Cmd-d" to select the "Don't Save" - where the "d" in the Cmd intuitively represents the "D" in the option - made for a much poorer and un-intuitive implementation in Lion. Substituting "Cmd-Delete" for "Cmd-d" is a mis-representation: because I am not Deleting a document, I am Not Saving a draft document that I had started.



[ Reply to This | # ]
Activate the Don't Save button in Lion from the keyboard using AppleScript
Authored by: benwiggy on Mar 17, '12 04:24:40AM

Ah, but you are deleting a document. Because unsaved documents are actually saved.



[ Reply to This | # ]
Activate the Don't Save button in Lion from the keyboard using AppleScript
Authored by: David Allen on Mar 17, '12 04:41:49PM

You appear to have written statements that contradict one another!

---
Dah•veed |David Allen|
Monterrey, NL, Mexico



[ Reply to This | # ]
Activate the Don't Save button in Lion from the keyboard using AppleScript
Authored by: benwiggy on Mar 22, '12 12:31:58AM

OK, then:

"Untitled documents that haven't been saved by the user are auto-saved by the OS. So when you close an Untitled document, you have to delete the auto-saved copies if you don't want it, rather than merely not save it."

Clear?



[ Reply to This | # ]
Activate the Don't Save button in Lion from the keyboard using AppleScript
Authored by: flip on Mar 17, '12 09:28:57AM
They didn't change that hot key for no reason: Cmd-D has always been the hot key to jump to the Desktop folder in Finder and in Open dialogs. So by making this change in Save dialogs, they actually made things more intuitive (at least for new Mac users and for people who have no problems adapting to change—and remember, the ability to adapt is key to survival!).

Now about the new hot key, you may argue that not saving a document is different than deleting it, if you like to split hairs, but you gotta admit that the result is the same. And at least it's an easy one to remember.

[ Reply to This | # ]

Activate the Don't Save button in Lion from the keyboard using AppleScript
Authored by: bretperry on Mar 20, '12 09:39:04AM

No, command-d had always been don't save. Also "Duplicate" in the Finder.
command-SHIFT-d is go to desktop.

command-delete is NOT a great choice, too easy to loose track of your focus, think you are doing command-d in a dialog, but don't realize you have a folder selected on server -- command-delete -- folder is deleted from server and gone forever as server has no trash can (unless command-z saves you).

I don't so much mind them changing it, but it would have been nice to TELL us, I am thankful for this post as I never would have guessed command-delete.
I DO wish one could change it, though, in a normal sys preferences manner, or at least thru terminal.



[ Reply to This | # ]
Activate the Don't Save button in Lion from the keyboard using AppleScript
Authored by: rootsup on Mar 16, '12 01:26:06PM

Can't you just hit the D key? It works in photoshop at least....



[ Reply to This | # ]
Activate the Don't Save button in Lion from the keyboard using AppleScript
Authored by: unforeseen:X11 on Mar 17, '12 04:42:51PM

If you turn on Full Keyboard Access in System Prefs > Keyboard, you can focus that key with Tab (in many Apps it will already have the focus) and hit Space.

---
this is not the sig you`re looking for.



[ Reply to This | # ]
Activate the Don't Save button in Lion from the keyboard using AppleScript
Authored by: TimA on Mar 18, '12 11:18:30AM

I miss this keyboard shortcut as well, but I can see that use of "D" for delete is very much at odds with the conflicting and completely opposite convention of "D" for duplicate (or Cmd-Shift D for dispatching an email in Apple's Mail.)
This might be a case of relearning some old habits and going with emphasizing the Delete key itself for such functions.



[ Reply to This | # ]
Activate the Don't Save button in Lion from the keyboard using AppleScript
Authored by: baltwo on Mar 19, '12 06:26:06PM

BTW, the Terminal command:

defaults write NSGlobalDomain NSSavePanelStandardDesktopShortcutOnly -bool YES

no longer works in 10.7.3.



[ Reply to This | # ]
Activate the Don't Save button in Lion from the keyboard using AppleScript
Authored by: pgr on Mar 20, '12 01:41:05AM

I tried this with Safari open and it totally screwed up my reading list. All that shows up in the list is dozens of duplicates of the same page and now all my other pages are gone (although still on Safari on my iPhone 4). How can I fix this?



[ Reply to This | # ]
Activate the Don't Save button in Lion from the keyboard using AppleScript
Authored by: Udo on Mar 20, '12 10:23:34AM
On second thought Cmd-opt-S would be better, because in the case of saving, Cmd-shift-S has the traditional us of "Save as". (Which of course now is "Export" but retained the Cmd-shift-S shortcut. It would better be "Cmd-E". In the long term it would be better for a major change in functionality, such as we have here, that the new shortcuts would correspond to the new menu name.
---
Have a nice day
Udo


[ Reply to This | # ]
Activate the Don't Save button in Lion from the keyboard using AppleScript
Authored by: Udo on Mar 20, '12 09:32:03AM

I agree some keyboard shortcuts are no longer intuitive. I like the use of the shift key to indicate the opposite of what a key normally does, as is its use in many apps.
So, "do not save" would logically be best invoked with cmd-shift-D.
My2˘ worth anyhow.

---
Have a nice day
Udo



[ Reply to This | # ]
Activate the Don't Save button in Lion from the keyboard using AppleScript
Authored by: PaperCutPro on Mar 20, '12 10:28:19AM

You know, there's a system tweak for that in MacPilot and probably other, similar apps that let you change some typical OS X behaviors. Probably Onyx... I never realized it was an issue until I saw it as an option to change, so I did and never thought about it since. Thinking back, it seemed like there were a few apps that had stopped responding to cmd-d, but there are so many cool little gidget, gadget apps out there that can help you change a keystroke, I think it's been a non-issue for most people that would care. - PPC



[ Reply to This | # ]