#!/bin/bash

sleep 5

f=$(ls ~/Desktop/movie)

while true ; do

open /Applications/Quicktime\ Player.app
sleep 1
osascript -e "tell application \"Quicktime Player\" to open \"Macintosh HD:Users:$USER:Desktop:movie:$f\"" > /dev/null
while true ; do
n=$(osascript -e 'tell application "Quicktime Player" to get name of document 1')
if [ "$n" == "$f" ] ; then
break
fi
sleep 1
done

while true ; do
osascript -e "set Volume 5"
osascript -e 'tell application "Quicktime Player" to set looping of document 1 to true '
osascript -e 'tell application "Quicktime Player" to set presenting of document 1 to true '
osascript -e 'tell application "Quicktime Player" to set audio volume of document 1 to 1 '
osascript -e 'tell application "Quicktime Player" to set muted of document 1 to false'
osascript -e 'tell application "Quicktime Player" to play document 1 '
rc=$?
if [ $rc != 0 ] ; then
break
fi
sleep 1
done

killall "QuickTime Player"

done


I work for the Department of Redundancy Department