2016-09-18 30 views
0

我正在制作日历警报工作流程,该工作流程从网站提取文本并将其与每天一次存储在本地文件中的文本进行比较。我将这些文本存储在Automator的两个变量“newText”和“oldText”中。通过下面的苹果脚本代码,我尝试访问并比较这两个变量。如果他们是平等的,我希望突破工作流程。从日历事件启动时工作流程中的错误

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 

从自动机运行时的工作流程工作正常,但是从日历事件中,我得到以下错误(二线)启动时:

语法错误,线预计年底,等却发现““”。

所有的建议表示赞赏!

回答

0

外的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 
+0

非常感谢!当把比较内容放在“tell”块中时,这也是个诀窍。 – mort