Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Some ideas for playing a notification sound in a script runtime:

Shell

  # system beep; also flashes the screen if you have that enabled in accessibility
  osascript -e 'beep'
  
  # play the sound file given by the file system the path
  afplay /System/Library/Sounds/Hero.aiff
AppleScript

  beep
  
  do shell script "afplay '/System/Library/Sounds/Hero.aiff'"
  
JXA + Cocoa API

  $.NSBeep()
  
  // search for and play a sound file; the lookup path is defined by macOS
  $.NSSound.soundNamed('Glass').play


Also shell (edit: as noted elsewhere):

$ say "Your build is done."




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: