2016-09-18 27 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