AppleScript Quicktime Player to play audio file generates error My Quicktime Player (Version 10.3 727.4) can play mp3 files without any problems, but when I use AppleScript I get an error message: 


  The document “audio.mp3” could not be opened. The file may be damaged or may not be a movie file that is compatible with QuickTime Player. 


I've been trying different sound files, different compressions, aif, wav, with the same result. 

A minimum script goes:

set audioFile to "/Path/to/the/audio.mp3"

tell application "QuickTime Player"
    activate
    open audioFile
    play the front document
end tell


Does anyone have any suggestions of what I'm doing wrong or any other solution to script a media player.
A pure guess would be that you are passing it a text/string reference rather than a file ref.

try set audioFile to POSIX file "/Path/to/the/audio.mp3"