You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

AppleScript通知不弹窗显示及Frog音效失效问题求助

解决AppleScript通知不弹窗及音效失效问题

通知仅显示在通知中心的修复方案

  • 检查通知权限设置
    打开「系统设置」→「通知」,找到你运行脚本的应用(比如「脚本编辑器」或「终端」),确认:
    • 通知样式设置为「横幅」或「提醒」(不要选「无」)
    • 勾选「在通知中心显示」和「播放提示音」(如果需要音效)
  • 移除不必要的激活命令
    原脚本里的tell application "Finder" to activate会让通知以Finder的身份发送,若Finder的通知设置被限制就不会弹窗。直接删除该行,让通知以当前脚本运行应用的身份发送,更易管控权限。

Frog音效无法播放的解决方法

  • 确认音效名称与系统文件匹配
    系统自带音效存放在/System/Library/Sounds/目录下,检查是否存在Frog.aiff文件。sound name参数需要使用不带后缀的文件名,且大小写敏感,确保拼写为"Frog"。
  • 检查应用的提示音权限
    在「系统设置」→「通知」中,对应脚本运行应用的「播放提示音」选项必须勾选,否则即使音效存在也不会播放。
  • 备选:使用完整音效路径
    如果直接用名称无效,可以尝试指定完整文件路径:
    display notification "已取消静音" sound name "/System/Library/Sounds/Frog.aiff"
    

修改后的完整脚本

set inputVolume to input volume of (get volume settings)
if inputVolume = 0 then
    set inputVolume to 100
    display notification "已取消静音" with title "音量调整" subtitle "输入音量设为100%" sound name "Frog"
else
    set inputVolume to 0
    display notification "已静音" with title "音量调整" subtitle "输入音量设为0%"
end if
set volume input volume inputVolume

内容的提问来源于stack exchange,提问作者programmmm

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.06 18:35:51