10.7: Scripting a fix for the loss of the Command+D shortcut

Jul 22, '11 07:30:00AM

Contributed by: r2xman

I do a lot of writing with TextEdit, using a keyboard shortcut with the macro editor QuicKeys. My SL macro would switch to or open TextEdit, close any previous TextEdit document using the built-in Mac keyboard shortcut Command+D (which closes a window without saving). Lion has evidently done away with the Command+D shortcut, so my macro wouldn't work. Here is a simple script that opens or switches to TextEdit, closes (without saving) any note that is there, and opens a new note:

tell application "TextEdit"
  activate
  try
    close window 1 saving no
  end try
  make new document  
end tell
This can be entered in QuicKeys and activated with the keyboard shortcut of your choosing.

[crarko adds: I suppose the removal of Command+D is a result of the new Auto Save feature; things get saved whether you intend it or not.]

Comments (13)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20110721075908624