从日历事件启动时工作流程出错

Error in workflow when launched from calendar event

我正在制作一个日历警报工作流程,每天从网站中提取文本并将其与存储在本地文件中的文本进行比较。我将文本存储在 Automator 中的两个变量 "newText" 和 "oldText" 中。使用以下 apple-script 代码,我尝试访问和比较这两个变量。如果它们相等,我想打破工作流程。

on run {input, parameters}

    set newText to value of variable "newText" of front workflow
    set oldText to value of variable "oldText" of front workflow

    if newText is equal to oldText then
        tell me to quit
    end if

end run

当 运行 来自 automator 时,工作流程工作正常,但是当从日历事件启动时,我收到以下错误(第二行):

Syntax Error, Expected end of line, etc. but found “"”.

感谢所有建议!

在 Automator 之外,您必须将相关代码包装在应用程序告诉块中

tell application "Automator"
    set newText to value of variable "newText" of front workflow
    set oldText to value of variable "oldText" of front workflow
end tell
if newText is equal to oldText then
    tell me to quit
end if