handle quicktime 7 error

I am working on on a script that tells QuickTime Player 7 to do a variety of things to a batch of files. I can trap for a lot of common errors like if the file exists before starting the QT tell block and that all works fine.

However, there are some errors that QT7 will generate only after opening a file. In particular, if the file being opened is a QT reference file but the referenced media is not available. When that happens QT7 puts up a dialog box asking if it should search for some piece of the QT reference.

What I am wondering is if there is a way for me to trap those errors and deal with them so my script can continue with the next file in the batch. I hope I am being clear but, if not, just ask.

Thanks in advance for any insight you can provide.


It seems that it’s too late to trap the error once you try to open the movie with QT7. If true then your best bet would be to query the movie with some other program that doesn’t have to actually open the movie file. You may be able to do this with system events. It can get information about a movie file without opening it. Try this. Maybe one of these lines will error without the dialog box on those files, and if so then you can use a standard try block of code to trap that error.

set movie_file to (choose file) as text

tell application "System Events"
	set movie_contents to contents of movie file movie_file
	set track1_props to properties of tracks of movie_contents
end tell

Thanks so much. I will explore that option.