Is there anyway to trigger an action when *cancelling* a script that has a delay?

Hopefully the subject is pretty clear. I have a script that includes a 1 hr delay. I’m wondering if there’s anyway to activate a cancel sequence if I manually cancel the script before the 1 hr delay completes?

Specifically, I have a script that turns a number of automations off, waits an hr (1 hr delay) and then turns the automations back on. If I manually turn off the script before the 1 hr delay expires I’d like it to automatically immediately enable the automations that were disabled.

Thanks.

Just a thought, make an automation that enables the automations when the script’s state go’s to ‘off’, and remove the enable services from your script.
Now every time the script turns off (delay or manually cancel) the automations get enabled.
Not tested!

2 Likes

That means I have to have an extra hidden automation, which doesn’t feel quite as “clean”… but I tested & it does work. Thanks!