尝试访问 Apple 提醒时出现 AppleScript 错误 -1700

问题描述

我收到以下 AppleScript 脚本错误,如果有人能解释原因,我们将不胜感激。

在 Apple 的提醒应用程序中,我创建了一个包含四个提醒项的简单列表,命名如下:

列表名称: 颜色

提醒: 红色、黄色、浅绿色、深绿色

在 AppleScript 中,我设置了这个变量:

set lstMyList to {"Red","Yellow","Orange","Blue"}

我不明白的是以下内容,前两个语句有效,但第三个语句无效。

声明 1.(成功)

这将返回 true,因为提醒 1(“Red”)的名称在 lstMyList 中

tell application "Reminders"
    return (name of reminder 1 of list "Colours") is in lstMyList
end tell

声明 2.(成功)

这会返回{"浅绿色"、"深绿色"}

tell application "Reminders"
    return (name of every reminder in list "Colours") whose name contains "Green"
end tell

陈述 3.(失败)

这应该返回 {"Red","Yellow"},但会触发 -1700 错误

tell application "Reminders"
    return (name of every reminder in list "Colours") whose name is in lstMyList
end tell

弹出的完整错误是:

“提醒出现错误:无法将 {"Red","Blue"} 设为类型说明符。” 数字 -1700 从 {"Red","Blue"} 到说明符

我无法理解在第三种情况下发生了什么,因为第一个语句使用“is in lstMyList”没有任何问题,而第二个语句使用“whose”没有任何问题。

我应该补充一点,我知道可以通过翻转代码来完全绕过错误,例如循环遍历 lstMyList 并检查提醒。但是,我试图避免这样的解决方案,因为这将需要重复发送 Apple 事件,这会导致运行时间显着增加,尤其是在列表项较多的情况下。

这里的任何解释和/或建议将不胜感激。谢谢。

解决方法

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

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

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