Click cancel in System dialog


My macbook air keeps restarting itself, I think it's an energy problem. It displays a restart dialog and if I click in the cancel button, I'm able to continue working, but sometimes it doesn't wait for a confirmation and restarts.

I was thinking of having a macro with a periodic trigger to run every second and click the cancel button.

For instance, the if with button condition doesn't work.

The 'press button' action doesn't work too.

How to reproduce?

  • Click on the 'Shut Down' menu at the Apple menu.

Whilst it is still working, generate a system report which will give you the model number/identifier and your unique machine serial number amongst other things and email the report to a friend.
Then reply to this thread what the model number is.

You do not say whether this is a problem that occurs on mains power or battery power or both, nor how old the machine is.

What you asking for does not seem a good workaround for replacing the battery. It is not too difficult, but depends on the model.

You could also run a hardware diagnostic test on startup with the proviso, backup first if possible.



Just make sure you do everything very very slowly and do not reinstall the operating system by mistake.

Hi @jonhathoni

I already tried several different approaches (reset smc, boot in safe mode, ...) and multiple reformats. I think it's a hardware issue because the lighning conector doesn't have the led on, the same charger works fine with another macbook.

I've just installed macos high sierra once again so I'd like to prepare this workaround at least to have it functional.

I think my problem could be solved with applescript and some UI skills. I have used Front Window Analysis Tool Using AppleScript System Events (get window elements) but I cannot see the buttons with that tool :frowning:

any help is really appreciated.

It is your call, of course, but I tend to agree with @jonathonl -- investing your precious time on automating this issue is likely a bad investment. IMO, your Mac could completely crash at any time.

It sounds like a serious problem to me. I would contact Apple support and ask them. Normally I would say take it to an Apple Retail store to the genius bar, but I think their stores are still closed.

I guess the only exception would be if you are stranded somewhere with only that Mac, and you have mission critical work to do. Then, of course, you try to make it last as long as possible, or until you can get Apple support. Or, here's another idea: replace your Mac with a new or used Mac. I've noticed some older Macs going for just a few hundred dollars on eBay.

Good luck. Sorry I can't be of more help.

I appraciate the advise but I don't have many options. I live in a place where there are no Apple stores and the Apple tech support is close to None. Same for getting a new one. Not possible right now :frowning:

So the workaround is still valid as it's a simple click on a cancel button, this might have to be done through 'System Events' and applescript.

OK, we'll try to help. But what will you do when your Mac dies?

Before you take steps to counteract this, are you completely certain you don't have a Keyboard Maestro macro or some other software causing this?

the macbook which shows the problem didn't have KM when the problem started.

@JMichaelTX I just want to prevent the restart. That is: click on the 'Cancel' button when the dialog appears. The dialog is the same as the one that appears after click in the shutdown info.

  1. Apple Menu
  2. Shut down...
  3. Click on cancel (this is what i'm trying to do)