Search code examples
macosapplescript

AppleScript - how to close "Your computer was restarted because of a problem" popup?


How to close the "Your computer was restarted because of a problem" popup in AppleScript? enter image description here

We use a VM to execute e2e tests and they often fail because of this popup. I would like to programmatically close it.

I tried listing the windows based on https://stackoverflow.com/a/26196136, but the popup is not included in the list


Solution

  • tell application "System Events"
        tell application process "Diagnostics Reporter"
            if (exists window 1) then click button "Ignore" of window 1
        end tell
    end tell