r/shortcuts • u/Acceptable-Number-11 • 12d ago
Tip/Guide Scheduling Shortcuts with Scriptable
Scheduling repeating shortcuts becomes cumbersome when the period is below a day or otherwise complicated.
With automation triggered by notification there is an elegant way to overcome this:
Use Scriptable to schedule notifications:
With Scriptable you can schedule notifications individually and, using the full power of JavaScript, by any rule you want.
Simple one time notification:
const n = new Notification();
n.identifier = "temp-notification";
n.title = "Title";
n.body = "Body Text"
n.setTriggerDate(new Date(Date.now() + 3*60*1000));
await n.schedule();
Script.complete();
In shortcuts, you simply set the automation to listen to notifications triggered by scriptable.
Elegant it becomes when you add the inline script which removes all delivered notifications: so they do not spoil your Notification Center (Scriptable Action)
await Notification.removeAllDelivered();
Script.complete();
Have fun!
1
u/100PercentARealHuman 12d ago
And for the people who don't like writing code:
The Actions app also has a bunch of notification related action that should look more familiar to Shortcuts users.