quicktime and exporting

Hello all.

I am trying to write a script that will take every .mov file in a folder and convert it to an .avi file, to be saved in another folder. (I am a MATLAB and Java programmer, but not Applescript, so bear with me.) I came up with the following ad hoc script after a night of trying to learn Applescript, but it isn’t quite working. The movies open, but the exporting does not occur. Any experienced users have any suggestions? (PS I know it is probably super inefficient and clunky, but I am trying!) I’m running Tiger w. Quicktime 7 Pro.

Thanks a ton,
Chris

tell application “Finder”
tell folder “vmovieclips” of folder “Desktop” of folder “chris” of folder “Users” of startup disk
set file_list to name of every item
end tell
end tell

repeat with i from 1 to count (file_list)
set the_name to item i of file_list
set the_file to “Alloy:users:chris:desktop:vmovieclips:” & the_name
set the_new to “Alloy:users:chris:desktop:conv:” & the_name & “.avi”
tell application “QuickTime Player”
activate
open file the_file
if (can export movie 1 as AVI) is true then
tell movie 1
export to the_new as AVI using most recent settings
end tell
end if
tell movie 1 to close
end tell
end repeat

Hi Chris,

There are several types of references. For QuickTime’s ‘export’ command, you want a file specification. i.e. a reference to a file that does not already exist. So, try changing this line:

set the_new to “Alloy:users:chris:desktop:conv:” & the_name & “.avi”

to:

set the_new to (“Alloy:users:chris:desktop:conv:” & the_name & “.avi”) as file specification

gl,

thanks, kel, for your quick reply.

i changed the line but am still getting the same problem: the event log gives (seemingly) all the right commands, but no new file is created… an export window flashes for a nanosecond on the screen, but with no results. here’s the relevant part of the event log

tell application “QuickTime Player”
activate
open file “Alloy:users:chris:desktop:vmovieclips:assaultprecinct.mov”
can export movie 1 as AVI
true
export movie 1 to file “Alloy:Users:chris:Desktop:conv:assaultprecinct.mov.avi” as AVI using most recent settings
close movie 1
end tell

thanks a lot for your help.

-chris

update: i changed avi to dv stream and it worked… so avi is giving it trouble. any ideas why?

I don’t see any ‘file specification’ in your script.

no, no, i changed the script to include file specification, like you said… what i posted was the event log, not the script.

so here is my weird situation:

when i change the export to DV stream, it works.

if i then change it back to AVI, but run it on the DV file, it exports it to avi.

when i try to export the original .mov file to avi, no dice.

any ideas??

problem solved. my divx codec was interfering with the avi export… i deleted the codec, and now it works beautifully

Hey,
I need to convert about 250 .dv files to .mov files with other settings. i have tried to fiddle with chris’s code, but i can’t seem to get past the NSReceiverEvaluationScriptError: 4 in quicktime. can anyone tell me what i am doing wrong? (i have quicktime 7 pro and am running 10.4.1) Thank you very much!
log :
tell application “QuickTime Player”
activate
open file “Alloy:users:sam:desktop:vmovieclips:xClip 06.dv”
can export movie 1 as QuickTime movie
“QuickTime Player got an error: NSReceiverEvaluationScriptError: 4”

Applescript:

tell application “Finder”
tell folder “vmovieclips” of folder “Desktop” of folder “sam” of folder “Users” of startup disk
set file_list to name of every item
end tell
end tell

repeat with i from 1 to count (file_list)
set the_name to item i of file_list
set the_file to “Alloy:users:sam:desktop:vmovieclips:” & the_name
set the_new to (“Alloy:users:sam:desktop:conv:”) & the_name & “.mov”
tell application “QuickTime Player”
activate
open file the_file
if (can export movie 1 as QuickTime movie) is true then
tell movie 1
export to the_new as QuickTime movie using most recent settings
end tell
end if
tell movie 1 to close
end tell
end repeat

Have you tried to just delete the part where it checks to see if the movie is exportable? That seems to be the line that’s giving you trouble. Or maybe the error means that it can’t be exported in that format?

Sorry if this is a little off-topic.

I got a QT 7 license for Windows and later read somewher that it supports VBScript. I’d like similar functionality as discussed in this post with VBScript. Can someone point me to resources/forums for this? Or someone on this list can help me get on the right track.

Thanks

Thanks Chris, that fixed the problem