Is there a way to run one of the new (in macOS 12) Shortcut tasks on a schedule? It seems you can do it manually in a few different ways, but I'm not seeing a way to automate it.

It doesn't seem to hook up to the old Automator app, which I believe is probably going to go away at some point anyway. It doesn't seem to be available as an alert action in the calendar.

Specifically I'm looking at the shortcut to send a daily agenda email - this is pretty much a perfect case for scheduling something, since iCloud Calendar doesn't have it as an option - but it's pretty useless if I have to remember to click a button every morning.


Related question on Stack Overflow:

Scheduling a terminal command or script file to run daily at a specific time Mac OS X

People are using launchd to achieve this. Personally, i use mysql server events with lib_mysqludf_sys-master and dedicated table replicating events. Hard to setup everything, but it's very convenient to add/edit/remove jobs by simply editing mysql table's rows.

To run a shortcut from terminal:

shortcuts run "YOUR SHORTCUT NAME"

To run with launchd your plist file should look something like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>Label</key>
        <string>com.example.volume</string>
        <key>ProgramArguments</key>
        <array>
                <string>sh</string>
                <string>-c</string>
                <string>shortcuts run "YOUR SHORTCUT NAME"</string>
        </array>
        <key>StartCalendarInterval</key>
        <dict>
                <key>Hour</key>
                <integer>23</integer>
                <key>Minute</key>
                <integer>45</integer>
        </dict>
</dict>
</plist>

Based on @Gintaras's answer, since you can run a shortcut from a shell script, I was able to get it done - but not with launchd.

Instead, I created a new application in the Automator app, to run a shell script, with the contents:

#!/bin/sh

cd /Users/MY_USER_NAME
shortcuts run "Email Schedule to Yourself"

Then I added a recurring calendar entry at 6am, with a custom alert to open a file, and selected this app. When the time hit, the email was sent successfully.

I've read rumors that Automator is on the way out someday, so this may not be a permanent solution, but I'm sure it'll get us through the next several years.

And FYI: I tried skipping the Automator step and running that script directly from Calendar, but apparently Calendar doesn't like running shell scripts.