Cancel Culture

Detect if users pressed “Cancel” on alert


Description

This is a demonstration of how to detect if a user has pressed “cancel” on an alert the last time they ran a shortcut.

A value is saved just before the alert is displayed.

  • If the user presses “OK,” then another value is updated. The next time the shortcut is run, something is done based on those saved values. In this example, another alert is shown, with the option to clear the cancel detector to start over. (This alert is not subject to the same cancel detection as the initial alert.)
  • If “Cancel” is pressed, then the second value is not updated, and when the user runs the shortcut again, something different happens based on those saved values. I like to think of it as the shortcut avenging its previous cancelation by “canceling” the user.

Note: while this example shortcut is rather silly, the concept is serious.


Latest Release Notes

1.0 - Aug. 1, 2020, 11:59 p.m.

Initial release.


Past versions