如何使applescript不等待音效完成?

如何使applescript不等待音效完成?,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 "afpl

我希望我的脚本在显示消息的同时播放声音。现在它播放声音,然后显示消息

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 &"
注意:如果路径不包含空格,则不需要在单引号中扭曲路径