The main problem that I ran into was when opening a file ala AppleScript, the file would open in the default editor, even if I told QuickTime to open it.
What follows is my script and the output.
Output time in seconds. There is one tab between the name of the file and the duration.
-- Alex Zavatone October 24, 2011
property pTargetFolder : missing value
property pFileCount : missing value
property pFileNames : missing value
property pFileDurations : missing value
property pOutputString : missing value
on run
main()
end run
on main()
Init()
AnalyzeFiles()
ParseLists()
end main
on Init()
tell application "Finder"
set pTargetFolder to choose folder with prompt "Please select folder with files to analyze:"
set pFileCount to the count of files of folder pTargetFolder
end tell
set pFileNames to {}
set pFileDurations to {}
end Init
on AnalyzeFiles()
repeat with myFileIndex from 1 to pFileCount
tell application "Finder"
set myFile to file myFileIndex of folder pTargetFolder
-- open (myFile as alias) using application "QuickTime Player" FAIL!
end tell
using terms from application "Finder"
tell application "QuickTime Player"
open (myFile as alias) -- using "QuickTime Player" -- 1 of folder pTargetFolder
end tell
end using terms from
tell application "QuickTime Player"
repeat while the number of documents < 1 -- (the file of the front document ≠ myFile)
delay 1
end repeat
set myDuration to the duration of the front document
end tell
set myName to the name of myFile
set the end of pFileNames to myName
set the end of pFileDurations to myDuration
tell application "QuickTime Player" to close the front document
end repeat
end AnalyzeFiles
on ParseLists()
set myString to ""
set myCount to the length of pFileNames
repeat with myIndex from 1 to myCount
set myString to myString & item myIndex of pFileNames & tab & item myIndex of pFileDurations & linefeed
end repeat
log myString
tell application "TextEdit"
activate
set myDoc to make document with properties {kind:text document}
set the text of the front document to myString
end tell
end ParseLists
01 Hello Tomorrow (adidas Version) 1.m4a 133.165
02 Shook me all night long.mp3 210.599183673469
07 El Mañana.m4a 233.128333333333
08 Pretty Donna.m4a 118.978333333333
1-06 The Politics Of Dancing.m4a 237.47
144 - CPM - the Dirty Mellow EP [Proton Music] On Sale at Beatport.com.mp3 167.444897959184
Cobol to HTML demo edited.mov 459.31084
Deepmix - Brian Ffar & Daniel Mnookin - Bucktown Business (Order the CD at
www.protonradio.com) Quast.mp3
129.515102040816
Feel Electric - Brian Ffar & Daniel Mnookin - Bucktown Business (Order the CD at
www.protonradio.com) Kevin Freeman.mp3
162.768979591837
Flesh For Lulu - I Go Crazy.mp3 235.232653061224
Freeze Peaches - Brian Ffar & Daniel Mnookin - Bucktown Business (Order the CD at
www.protonradio.com) Fermin Aguilera.mp3
150.517551020408
Gerry Rafferty - Baker Street.mp3 247.405714285714
Jars Of Clay - Liquid.mp3 211.696326530612
Miami - Brian Ffar & Daniel Mnookin - Bucktown Business (Order the CD at
www.protonradio.com) Crazy Larry & Missing Link.mp3
163.970612244898
Nintendope - Brian Ffar & Daniel Mnookin - Bucktown Business (Order the CD at
www.protonradio.com) Dafluke.mp3
203.702857142857
Phil (Droo's Mental Remix).mp3 208.561632653061
Replacements - I'll Be You.mp3 209.319183673469
She Is Beautiful.mp3 213.78612244898
The Replacements - 08 - I'll Be You.mp3 206.889795918367
feelgoodinc.m4a 221.238333333333
with guests Suburban Knight and Jamal Moss - Transmission on Proton Radio (03-23-06).mp3 214.047346938776