Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 44 lines (31 sloc) 1.248 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
-- DESCRIPTION: Takes a folder and shows the total duration of all the movie files in it.
--
-- AUTHOR: Geoffrey Grosenbach http://topfunky.com
-- August 29, 2008
on open (args)
  try

    set myFolder to (the first item of args)
    
    tell application "Finder"
      set movFiles to (files of folder myFolder whose name contains ".mov")
    end

    tell application "QuickTime Player"
      set totalDuration to 0

      repeat with movFile in movFiles

        open movFile
        set movProperties to the properties of the front document
        set movDuration to the duration of movProperties

        set totalDuration to totalDuration + movDuration
        close the front document
     
      end repeat
     
    end tell
     
    set totalDurationSeconds to totalDuration / 1000
    set totalDurationMinutes to (totalDurationSeconds / 60) as integer
    set totalDurationSecondRemainder to (totalDurationSeconds mod 60) as integer

    tell application "FastScripts"
      display message "Duration: " & totalDurationMinutes & ":" & totalDurationSecondRemainder dismissing after delay 10
    end
     
    on error errmsg
    -- should anything go wrong let the user know
    display dialog errmsg
  end try
  
end open
Something went wrong with that request. Please try again.