applescriptquicktime

Play Quicktime Player video using Applescript


So I wrote a little script that opens a video I want to play. As soon as it opens, it should play. I tried working with play, and even though Quicktime recognizes the word play, it doesn't actually play. What should I do?

tell application "Quicktime player"
    open file "/directory/to/the/file/"
    play --doesn't work
end tell

Solution

  • If you want to use a fully qualified POSIX pathname, you can use the following, to open and play the file:

    tell application "QuickTime Player"
        activate
        set thisFile to open POSIX file "/path/to/filename.mp4"
        play thisFile
    end tell