Apple脚本出现语法错误

时间:2016-08-22 14:25:26

标签: applescript osx-elcapitan

我想在我的消息应用中自动接受来自某个帐户的屏幕分享邀请。

我转到了Auto Accept.applescript并添加了以下内容

on received local screen sharing invitation from theBuddy for theChat
    accept theChat
end received local screen sharing invitation

但是当我尝试保存它时,我得到&#34;语法错误预期“给定”,“进入”,“带”,“不带”或其他参数名称但找到“本地”。&#34; < / p>

我错过了什么?

1 个答案:

答案 0 :(得分:0)

基本上你必须将代码包装在

using terms from application "Messages"


end using terms from

块。但是什么版本的Messages.app有一个on received local screen sharing invitation from theBuddy for theChat事件??

修改

屏幕共享邀请是视频邀请,事件local screen sharing invitation不存在。

using terms from application "Messages"
   on received video invitation theText from theBuddy for theChat
       set buddySN to (get handle of theBuddy)
       set allowedBuddy to "myAccount"
       if (buddySN is allowedBuddy) then
           accept theChat
       end if
   end received video invitation
end using terms from