-- quicktime records last 20 seconds of background audio in two 10 second chunks repeat while ((do shell script "ps -c -U $(whoami) | awk '/ScreenSaver/'") = "") delay 10 end repeat tell application "QuickTime Player" set x to 1 repeat until ((do shell script "ps -c -U $(whoami) | awk '/ScreenSaver/'") is "") start (new audio recording) delay 10 stop movie 1 set name of movie 1 to x close movie 1 if (x > 2) then set y to (x - 2) do shell script "rm ~/Desktop/" & y & ".mov" end if do shell script "mv ~/Desktop/Audio.mov ~/Desktop/" & x & ".mov" set x to (x + 1) end repeat end tell