目的
在 MacOS 下利用定时任务创建提醒事项,使其即时显示在 iPhone 上。(例如降价提醒)
方法一:通过 cron 服务执行 AppleScript
-
在 /Users/<username>/ 下创建脚本 cron_reminder.sh :
#!/bin/bash osascript << END set mydate to (current date) + (1 * minutes) tell application "Reminders" make new reminder with properties {name:"This is a cron reminder", remind me date:mydate, due date:mydate} end tell END
提醒时间设为当前时间再加一分钟,如果不加,在 MacOS 上会即时弹出提醒,但 iPhone 不会弹出(因为当前这一分钟已经过时了)。
Reminders 的参数可以参考 “脚本编辑器”,打开「脚本编辑器」 → 新建一个脚本 → 用快捷键 ⌘⇧O 打开 AppleScript 字典(Dictionary)。
-
给脚本赋予执行权限