如何使用 AppleScript/osascript 正确快速迭代提醒?

问题描述

使用 AppleScript 迭代 Reminders 的正确有效方法是什么?下面的脚本按预期工作,但是当使用 osascript 从命令行运行时,需要 18 秒来迭代超过 180 个提醒! (当从 ScriptEditor 中运行时,这个相同的脚本只需要 2-3 秒。)

# Find all Reminders whose name contains "Alumni"
set findMe to "Alumni"
set answer to "Maches: "

tell application "Reminders"
    set names to name of every reminder
end tell

repeat with name in names
    if name contains findMe then
        set answer to answer & " --- " & name
    end if
end repeat

return answer

我从命令行以两种方式运行此脚本:作为编译脚本:osascript testReminders2.scrpt 和作为文本文件./testReminders2.applescript(此文件#! /usr/bin/osascript 开头。两者都版本花费的时间大致相同。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)