AppleScriptで動画の長さを取得する

ファイルの情報を取得するのにはFinderにファイルを渡して問い合わせるのが一般的だと思う.
2/3 AppleScriptの構造を上手に調べる [Mac OSの使い方] All About

choose file
set theFile to result

tell application "Finder"
properties of item theFile
end tell

こんな感じにすると一通りの情報が出てくるが,動画に関しては長さやビットレート,解像度といった情報は出てこない.
Finderには表示されるわけだが,これは何らかの方法でFinder以外の部分が計算しているのだろう.

とりあえず方法としては,QuickTimeでファイルを開いてdocumentの要素を取り出すというものがある.

tell application "QuickTime Player"
	set tDoc to open theFile
	tell tDoc
		duration of tDoc
	end tell
end tell

一旦開くことになるのがいまいちかもしれない方法.

ちなみに何の値が取り出せるのかは,Script Editorで「ファイル」→「用語説明」→「QuickTime Player」と辿るとわかる.
AppleScriptでQuickTime Playerを自動化する | QuickTime