Close and DON'T save file

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.

That’s great! I had no idea you could use patterns in Press a Button.

Suppose I couldn’t though. I am sure this has been asked before but I can’t figure out how to find it: is there any way to have a series of actions, where the series (or macro itself) is exited once one of the actions succeeds? I know I can terminate the macro on failure, but I don’t know how to do something on success.

  • Press Button “Whatever”, no notification, no aborting
  • If text %ActionResult% is not OK
    • Press Button “Whatever Else”, no notification, no aborting
    • If text %ActionResult% is not OK
      • Press Button “Whatever Else”, no notification, no aborting
      • etc

They have to be nested as otherwise the If action will succeed at doing nothing and set %ActionResult% to OK.

To avoid nesting, you could do something like:

  • Press Button “Whatever”, no notification, no aborting
  • Set variable Result to %ActionResult%
  • If variable Result is not OK
    • Press Button “Whatever Else”, no notification, no aborting
    • Set variable Result to %ActionResult%
  • If variable Result is not OK
    • Press Button “Whatever Else”, no notification, no aborting
    • Set variable Result to %ActionResult%
  • etc

This is different. It is an error dialog. It has only one button, which you must press (or, since it is selected, type Return).

1 Like

The above macro works fine with one open tab.
How would I modify it for multiple tabs, ie make it recursive in the sense that each tab is closed in sequence until all tabs are closed.
thanks very much

Well, this is probably app dependent, but you might try this, assuming your documents are all in windows with a name:

  1. set KM variable (WinName) to name of frontmost window
  2. Repeat while WinName is not empty
    1. Execute the above macro/actions
    2. set KM variable (WinName) to name of frontmost window
    3. Maybe a short Pause (0.1 sec)
1 Like

Could you give me just a hint as to which actions I would use to do so ?
Thank you very much !