Quicktime error on Save...

Hello,
I’ve been trying to use the following script:

set theFiles to (choose file with multiple selections allowed)
tell application "QuickTime Player"
	repeat with theFile in theFiles
		open theFile
		rotate left movie 1
		save movie 1
	end repeat
end tell

I’m trying to use this script to rotate .avi movie files made with my digital camera (when shot holding “portrait”). I get the following error though, when saving:

“The document “Test_movie.avi” could not be saved.”

Now, if I’m working with .mov files, the script works fine, so I’m pretty sure the error is a result of it being an .avi file (as when I do this manually, when I save, it saves as a .mov files after choosing “self-contained movie” in the pop-up. But, when it’s done via Applescript, it just errors out.

Does anyone know how I can fix this?
I’d even be willing to do an “export” (as a .mov file) but I’ve tried coding that into Applescript (I’m a novice, so forgice me) but I just can’t seem to get it to work.

If anyone can help. it’d be greatly appreciated!
Thanks,
Kristin.

ps ” I’ve also searched and tried Applescript code written to do this sorta thing, but it hasn’t worked for me either. I assume because of the .avi format?