applescript - 如何让applescript不等待音效完成?
问题描述
我希望我的脚本同时显示一条消息并播放声音。现在它播放声音,然后显示消息。
do shell script "afplay '/System/Library/Sounds/Morse.aiff'"
display dialog "Could not find contact: " & "\"" & victim & "\"" with icon stop
我怎样才能解决这个问题?
解决方案
您可以通过重定向和丢弃stderr
来做到这一点stdout
stdout
do shell script "afplay /System/Library/Sounds/Morse.aiff >/dev/null 2>&1 &"
注意:如果路径不包含空格,则不需要在单引号中扭曲路径。
推荐阅读
- dataweave - 有没有我可以阅读的书可以帮助我使用数据编织?
- python - Python AWS - 从已发送电子邮件中获取RawMessageContent
- xamarin - SkiaSharp 在可点击的路径上制作位图
- c# - UNITY - 玩家控制器不向鼠标光标移动
- python - 使用 Python 根据数据更改 SQL UPDATE 语句
- ios - AppDelegate 未提供 UIViewController
- python-3.x - 使用 Python 优化排序任务
- c# - 如何在不调用基本默认构造函数的情况下实例化继承的类
- node.js - 如何使用 node/express 控制台记录 api 调用的 url
- html - 修复 IE 中 mat-expansion-indicator 的位置