Applescript:"预期的行尾等,但找到了类名。"

时间:2016-04-12 15:08:23

标签: macos applescript

我一直在研究AppleScript,但收到了这个错误: /Users/MYUSER/taskmaster/chromeCanary/lib/overrideOpenChrome.scpt:373:377: script error: Expected end of line, etc. but found class name.

奇怪的是,这个剧本之前似乎有用,所以我更加困惑,剧本如下:

 #!/usr/bin/osascript


 set ccss to "/Users/MYUSER/taskmaster/chromeCanary/chromeShouldStop/bool.rtf"
 set ccsr to "/Users/MYUSER/taskmaster/chromeCanary/chromeShouldRun/bool.rtf"

 do shell script "mv " & ccss & " " & ccsr 

 tell application "Google Chrome Canary"
   activate
 end tell
 display notification "30 Minutes remain" with title "TaskMaster" subtitle "Google Chrome Canary" with icon file "Users:MYUSER:taskmaster:assets:chrome-icon.icns"
 delay 900
 display notification "15 Minutes remain" with title "TaskMaster" subtitle "Google Chrome Canary" with icon file "Users:MYUSER:taskmaster:assets:chrome-icon.icns"
 delay 600
 display notification "5 Minutes remain" with title "TaskMaster" subtitle "Google Chrome Canary" with icon file "Users:MYUSER:taskmaster:assets:chrome-icon.icns"
 delay 60
 display notification "3 Minutes remain" with title "TaskMaster" subtitle "Google Chrome Canary" with icon file "Users:MYUSER:taskmaster:assets:chrome-icon.icns"
 delay 60
 display notification "1 Minute remain" with title "TaskMaster" subtitle "Google Chrome Canary" with icon file "Users:MYUSER:taskmaster:assets:chrome-icon.icns"
 tell application "Google Chrome Canary"
   quit
 end tell
 do shell script "mv " & ccsr & " " & ccss 

我的问题在哪里?路径是正确的,我检查并仔细检查,所以它不可能。

编辑:我是愚蠢的。如果你发现了同样/类似的错误,请参阅下面的答案。

1 个答案:

答案 0 :(得分:0)

好的,显然你不能使用with icon file& display notification,您只能将其与display dialog一起使用。你可以得到的最接近的是应用程序的图标。