Skip to content

Instantly share code, notes, and snippets.

@semicolonsnet
Created November 30, 2020 19:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save semicolonsnet/e8775b94367f68fd56ac5b6d115de84c to your computer and use it in GitHub Desktop.
Save semicolonsnet/e8775b94367f68fd56ac5b6d115de84c to your computer and use it in GitHub Desktop.
A quick-and-easy AppleScript to 1) loop a background music file, and 2) fade that file out when a dialog button is pressed. I use this when presenting slide decks virtually.
tell application "QuickTime Player"
set theFile to open POSIX file "FILENAME HERE"
set audio volume of theFile to 0.3
set looping of theFile to true
play theFile
end tell
display dialog "Music Control" buttons {"Fade"}
tell application "QuickTime Player"
repeat 30 times
set theValue to (audio volume of theFile) - 0.01
set audio volume of theFile to theValue
delay 0.2
end repeat
quit
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment