reminder=$(osascript -e 'tell application "Reminders"
set activeReminders to (reminders of list "测试" whose completed is true)
set numOfActiveReminders to (count of activeReminders)
set allReminders to (reminders of list "测试")
set numOfAllReminders to (count of allReminders)
set result to ((numOfActiveReminders as string) & "/" & numOfAllReminders as string)
return result
end tell')
todolist=$(osascript -e 'tell application "Reminders"
set todos to (reminders of list "测试" whose completed is false)
set newlist to {}
repeat with todo in todos
copy (name of todo as text) to the end of the newlist
end repeat
return newlist
end tell')
todolist=${todolist// /} # 删除空格
todolist=${todolist//,/ } # 转换 AppleScript 的 list 为 shell 的 list 格式
if [ "$1" = "done" ]; then
osascript -e "tell application \"Reminders\"
set activeReminders to (reminders of list \"测试\" whose completed is false)
repeat with todo in activeReminders
if (name of todo as text) is equal to \"$2\" then
tell todo
set completed to true
end tell
end if
end repeat
end tell"
fi
if [ "$1" = "open" ]; then
osascript -e 'tell application "Reminders" to activate'
fi
!/bin/sh
reminder=$(osascript -e 'tell application "Reminders" set activeReminders to (reminders of list "测试" whose completed is true) set numOfActiveReminders to (count of activeReminders) set allReminders to (reminders of list "测试") set numOfAllReminders to (count of allReminders) set result to ((numOfActiveReminders as string) & "/" & numOfAllReminders as string) return result end tell')
todolist=$(osascript -e 'tell application "Reminders" set todos to (reminders of list "测试" whose completed is false) set newlist to {} repeat with todo in todos copy (name of todo as text) to the end of the newlist end repeat return newlist end tell') todolist=${todolist// /} # 删除空格 todolist=${todolist//,/ } # 转换 AppleScript 的 list 为 shell 的 list 格式
if [ "$1" = "done" ]; then osascript -e "tell application \"Reminders\" set activeReminders to (reminders of list \"测试\" whose completed is false) repeat with todo in activeReminders if (name of todo as text) is equal to \"$2\" then tell todo set completed to true end tell end if end repeat end tell" fi
if [ "$1" = "open" ]; then osascript -e 'tell application "Reminders" to activate' fi
echo "✔︎ $reminder" echo "---" echo "Open Reminder| bash='$0' param1='open' terminal=false" echo "---" for loop in $todolist do echo "${loop%,} | bash='$0' param1='done' param2='${loop%,}' terminal=false refresh=true" done | sort echo "---" echo "↻ Refresh| terminal=false refresh=true"