Close and DON'T save file

Hello,
I often ‘close and do not save’ files, and thought that it would be a good idea to create a hotkey to do so.
Close: Type Cmd-W
How would I add 'do not save’
thanks very much

Often, but NOT always, the app will display the following dialog, where pressing the SPACE key will complete the close without saving:

If the apps you plan to use this macro with ALL use this dialog, then the following actions should work:

If you have some apps that don't use this dialog, then you may need to use AppleScript to issue the specific command that app needs to "Close without saving".

1 Like

thank you for taking the time to make a commented snapshot and to propose a macro.
I also use textwrangler, and did a test: space (i assume you mean spacebar) does not do anything when the don’t save-cancel-save dialog box appears. I tried the backspace key and it does not do anything either.
thanks again

That’s very strange. I use SPACE (or SPACEBAR) all the time to select the alternate button (the one with a heavy blue border). Hmmm, maybe this is a setting in OSX Preferences. I’ll take a look, but you might do the same.

1 Like

I will also look. thank you.

I don’t see a System Preferences setting, but I did just find this, and it works for me in TextWrangler. You might give it a try:

⌘⌫ (command+delete) while in a save dialogue box is the shortcut for “Don’t save”.

I can’t say how universal it is, but we can try it out. :smile:

2 Likes

This could be the cause:

Go to System Preferences—>Keyboard and Mouse. Click on the Keyboard Shortcuts tab. At the bottom, you’ll find a pair of radio buttons, labelled “Text boxes and lists only” and “All controls”. Click on the lower button, “All controls”.

You should then be able to navigate all buttons as well, using the Tab key. The focus is shown as a blue border. Pressing the spacebar clicks the currently selected button.

1 Like

###Here's a better solution. Don't know why I didn't think of this to start with.

1 Like

Following your response, I looked at system pref and found the all controls solution as per your response. I even prefer your last solution which I can use for many other macros, such as opening a Pages Template.
You are very kind and … very smart ! thanks so much !

1 Like

Great! Glad that works for you.

Could you do me a favor? We have just installed a new "best answer" feature (it calls it "this reply solves the problem"). At the bottom of each post you should see a checkbox that you can check indicating that you prefer that solution. Could you please check the one that you like best?

thanks.

1 Like

done, and thanks for the tip

1 Like

The problem with this solution and the rest of the discussion on this page is that applications use at least four wordings of the “Don’t Save” button when you close an unsaved documents, some because of the document backup system introduced a few OS-X releases earlier.

  • Don’t Save
  • Delete
  • Delete Copy
  • Revert Changes

My macro Do Don’t Save handles all four cases using an AppleScript.

1 Like

Hi, thanks very much for your comment. I tried your macro in my label making app (PTouch) and got this error message.

Press Button “Don’t Save|Don’t Save|Delete|Delete Copy|Revert Changes”

2 Likes

I don’t like mixing “Don’t Save” with “Delete” in the same Action as alternate Button text. Perhaps they mean the same thing in most cases, but I’d rather not press the button occasionally rather than actually delete a file I didn’t want to.

2 Likes

I will try that again, now that I have tried a number of approaches. I don’t think a Press a Button action worked in all cases. In any case it’s a very old script and definitely worth a fresh look to see how I can accomplish this without a script.

Good point. I have a new version that first tries to find the button and if it can’t uses Found Images. It’s working well, but I have a few more examples to check.

Do me a favor, please. See if you can press that button with a KM Press a Button action. I suspect not. I have had a similar problem with Press a Button in other non-conforming applications I am going to check them again.

works fine for me

My point is that by putting “don’t save” and “delete” in the same button, then you could accidentally delete a file that you did not intend to.

Please clarify. Did you mean in the same dialog, not same button? And for my own purposes I would like an example of an application where Delete and Don’t Save might be in the same dialog, and what conditions produce that. I don’t think Delete every means “Don’t Save and delete the existing file”, so I don’t see how there would be any confusion.