Extract video track from dropped files in QT (Pro 7.6.6)

Hi! I’m trying to extract the video track from a set of dropped files, close the original and save the new with an added “-v” file suffix to the original file name, to the original folder of the dropped files.

I’m new to this - having issues both with the variable/event handling and the extraction of the content. My first attempt:


on open droppedFiles
	tell application "QuickTime Player 7"
		activate
		repeat with thisFile in droppedFiles
			open thisFile
			set newFile to name of thisFile & "-v"
			tell thisFile
				export (track whose name is "Video Track") to file newFile as QuickTime movie
			end tell
			close thisFile
			close newFile
		end repeat
	end tell
end open

…opens the right file in QT then returns

I then simplified and tried:


on open thisFile
	tell application "QuickTime Player 7"
		activate
		open thisFile
		tell thisFile
			export track "Video Track" of thisFile to file
		end tell
		close thisFile
	end tell
end open

…which also opens the file in QT then returns


By [correct path] I mean the path of the dropped file.

I clearly need some pointers here. I appreciate any feedback.
Thanks a million,
O

Model: Macbook Pro
AppleScript: 2.1.2
Browser: Firefox 39.0
Operating System: Mac OS X (10.6.8)

aliases don’t have tracks, documents do.

set the doc to open thisfile
tell theDoc
.
 

There seems to be other problems, namely in the new file name.

Later.
Hope this gets you going somewhere.

Ok, that makes sense.

set the doc to open thisfile
tell theDoc
.
 

Even when I set and call the variable like so (using theDoc in both instances), it still gets referred to as an alias with the same error message.

Right - that’s an additional hurdle.

Bumping this. I never really got any help.
Would really appreciate some feedback…
Thank you!


-- Doing just one file for convenience of example
-- for OS X 10.6.8

set inFileFP to (((path to desktop) as text) & "movie.mp4") as text
set outFileFP to (text 1 thru -5 of inFileFP) & "-v.mov" -- file extension length may vary

tell application "QuickTime Player 7"
	activate
	try
		close every window saving no
	on error
		--
	end try
	
	open inFileFP
	
	tell document 1
		if name of track 2 is "Video Track" then -- for convenience; you could loop and test to get number of "Video Track"
			with timeout of 100000 seconds
				export track 2 to file outFileFP as QuickTime movie
			end timeout
		end if
	end tell
	
	try
		close every window saving no
	on error
		--
	end try
	
end tell