Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/116.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Applescript 显示通知不再在El Capitan中工作_Applescript_Zsh_Osx Elcapitan_Osascript_Notificationcenter - Fatal编程技术网

Applescript 显示通知不再在El Capitan中工作

Applescript 显示通知不再在El Capitan中工作,applescript,zsh,osx-elcapitan,osascript,notificationcenter,Applescript,Zsh,Osx Elcapitan,Osascript,Notificationcenter,当我想从shell中的脚本创建通知时,我的.zshrc中有一个函数: notify() { osascript -e 'display notification "${*}"' } 该函数只运行一行applescript来创建一个通知,通知中包含传递给它的任何参数,我可以这样做: transmission SOMEFILETODOWNLOAD && notify Torrent complete 问题是自从我升级到El Capitan后,这个功能就不再工作了。它以静默方式失败

当我想从shell中的脚本创建通知时,我的.zshrc中有一个函数:

notify() { osascript -e 'display notification "${*}"' }
该函数只运行一行applescript来创建一个通知,通知中包含传递给它的任何参数,我可以这样做:

transmission SOMEFILETODOWNLOAD && notify Torrent complete
问题是自从我升级到El Capitan后,这个功能就不再工作了。它以静默方式失败,不创建通知

我在脚本编辑器实用程序中单独运行了applescript部分,它工作得很好,所以我知道显示通知并没有遭到反对。我猜这与从命令行或zsh运行它有关


我想不出来。有什么想法吗?

您需要允许终端通过将其添加到中的列表来控制您的系统

系统首选项>隐私>可访问性>
允许下面的应用程序控制您的计算机

这与静默故障无关,无法再现,但功能定义显然存在缺陷。它将始终打印*,因为您总是将显示通知${*}逐字发送到osascript。谢谢,我可以解决这个问题。然而,我仍然没有得到任何输出,即使我直接在shell中运行它时使用了如下内容:osascript-e“display notification Test”Try 1注销并重新登录;2重新启动。有时,这会修复与通知中心相关的问题。已尝试多次。不走运,不知道。您是否从Yosemite升级或执行了干净的安装?我的干净安装没有问题。