Thanks for this, Hank. I could see it in the dictionary, but couldn’t make anything that worked. Your approach is what makes it useful. Elegant, even.
Having said that, your approach seems to work in some cases, but not in others. For example running it against one video produced this event log:
tell application “QuickTime Player”
get every track of document 2
{track 1 of document “Community Forest Video.m4v”, track 2 of document “Community Forest Video.m4v”}
get type of track 1 of document “Community Forest Video.m4v”
“soun”
get type of track 2 of document “Community Forest Video.m4v”
“vide”
end tell
and the result, as expected, is True.
However, running it against another video produced this event log:
tell application “QuickTime Player”
get every track of document 1
{track 1 of document “rango_963_320x128.mpg”}
get type of track 1 of document “rango_963_320x128.mpg”
“MPEG”
end tell
and the result, unexpectedly for me, at least, was False, which upon reflection maybe is because the result wasn’t ‘vide’ but ‘MPEG’.
I thought they both should have been True as they’re both videos, as the app’s dictionary seems to suggest. As you can see by the file names, however, they’re different kinds of video.
In your script, I tried changing ‘type’ to ‘kind’ and ‘Video’ as that seems to be an alternate in the dictionary, but the result was the same.