Browse the docs

An error dialog appears

Runs the macro when any app shows an alert, sheet or system dialog, with its text and buttons.

An error dialog appears in app

Details #

Watches every running app for a new alert, sheet or system dialog and runs the macro when one appears. The macro is handed what the dialog said, so it can log it, explain it, copy it or press one of its buttons.

A new window counts as a dialog when it is a sheet, or its role is a dialog, a system dialog, or a floating window that has buttons, and it holds some text. Alerts from the system's own alert helpers (UserNotificationCenter and CoreServicesUIAgent) count too and arrive with kind set to system.

The macro gets these inputs, which you can use as {{ text }}, {{ buttons }} and so on:

InputWhat it holds
appThe bundle identifier of the app that showed it.
titleThe window's title, often empty for an alert.
textEvery line of text in the dialog, joined with line breaks.
buttonsThe titles of its buttons, left to right, as a list.
kinddialog, sheet or system.

{{triggerValue}} is the dialog's text.

All three parameters narrow it down, and all are optional. With none, every dialog in every app runs the macro.

Parameters #

ParameterTypeRequiredValuesWhat it does
apptextA bundle identifier such as com.apple.finder. Only dialogs from that app count.
buttontextA button title such as Don't Save. Only dialogs that have that button count.
texttextA regular expression, matched without regard to case against the dialog's text and title. An expression that is not valid matches nothing.

Every trigger also takes Limits: a cooldown, the first time each day, every nth time, twice within seconds, a chance, only while you are at the Mac, on one Mac, or in a State. See Limits on any trigger.

Examples #

Say what an error dialog said
When
  1. An error dialog appears
Do
  1. Show “{{ app }}: {{ text }}” for 4 s
Open in Switchboard to try it
Press Don't Save for TextEdit's save sheet
When
  1. An error dialog appears in TextEdit saying “save the changes” with the “Delete” button
Do
  1. Press the “Delete” button
Open in Switchboard to try it

Gotchas #

  • Switchboard only watches while at least one turned-on macro uses this trigger. With none, no app is observed at all.

  • An app that does not answer Accessibility within a quarter of a second is skipped. It is tried again the next time it comes to the front.

  • The dialog's contents are read about a fifth of a second after it opens, once the app has laid them out. A dialog that closes faster than that does not fire.

  • A macro that presses a button in the dialog does not trigger itself again: the dialog is gone by then.

  • Text in the dialog can include file names and other private details. A macro that sends it to a model or a web service sends those too.

See also #

A form field takes focus, Press button by name, The Inbox