Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Applescript for quicktime player 7 in 10.6

I've been using an applescript that can take a bunch of movie clips and merge them into a single file. (see script below) now with 10.6 and quicktime x. this script no longer works. Can anyone help me to get quicktime player 7 to launch and start doing it's trick. any help most appreciated.


on openthese_items

tell application "Finder" to set sorted_items ¬

to sortthese_itemsbyname

repeat with i from 1 to the count of sorted_items

set this_item to (itemi of sorted_items)

tell application "QuickTime Player 7"

if i is equal to 1 then


makenewdocument

end if


openthis_item

tell document 1


rewind


select all

copy


select none

end tell


closedocument 1 savingno

tell document 1

add


select none

end tell

end tell

end repeat

end open

Quicktime-OTHER, Mac OS X (10.6.7)

Posted on Jun 20, 2011 9:10 AM

Reply
3 replies

Jun 24, 2011 6:32 PM in response to norman13

The scripts below work for me, using Mac OS 10.4.11 and QuickTime Pro v. 7.6.4.


Note that my version of AppleScript (v. 2.1.1) doesn't recognize application QuickTime Player 7. Hence, application "QuickTime Player" was used throughout. Your needs may vary; if you can or must use the "7" by all means do so.


The first is based on the script Craig Williams posted in this thread: http://macscripter.net/viewtopic.php?id=31674 (in post #6). I modified the script a bit so that a new file is created on the front end, and the merged file gets written to it once the script finishes:


set file_name to text returned of (display dialog "A new merged QuickTime file will be created on the desktop. Please choose a name:" default answer "Enter Name")


tellapplication "Finder"


try


setmake_filetomakenewfileat (path todesktop folderasstring) with properties {name:file_name & ".mov"}


setnew_filetomake_fileasalias


onerror

display dialog "A file with the name " & "“" & file_name & "”" & " already exists on the desktop. Please try again." buttons {"OK"} default button 1 cancel button 1 with icon stop


endtry

endtell


settheCountto 1

set theFolder to choose folder with prompt "Choose the folder with QuickTime files you want to join together."

tellapplication "Finder"


settheFilestoeveryfileoffoldertheFolder


settotalFilesto (countthetheFiles)


repeatwithifrom 1 tototalFiles --to 1 by -1


setthisfiletoitemioftheFilesasalias


--QT Pro


mymergeFilesUsingQT(thisfile, theCount, totalFiles)


settheCounttotheCount + 1


endrepeat

endtell


delay 1


tell application "QuickTime Player"


telldocument 1


rewind

delay 0.5


saveasself containedinnew_file


close


endtell

endtell


onmergeFilesUsingQT(thisfile, theCount, totalFiles)

tell application "QuickTime Player"


activate

--the first file only gets copied

if theCount = 1 then


openthisfile

delay 0.5


telldocument 1


select all

copy


endtell


closedocument 1 savingno


else

--these files get the previous file added to it and

--then it is copied to be added to the next file


openthisfile

delay 1


telldocument 1


setxtogetduration


setcurrent timetox


paste


select all

copy


endtell


endif


endtell

endmergeFilesUsingQT



My own version, below, creates a new file and then opens a temporary QuickTime document to which each file is copied in turn. Once copying is complete, the temporary file is written to the file that was created at the beginning of the script:


set file_name to text returned of (display dialog "A new merged QuickTime file will be created on the desktop. Please choose a name:" default answer "Enter Name")


tellapplication "Finder"


try


setmake_filetomakenewfileat (path todesktop folderasstring) with properties {name:file_name & ".mov"}


setnew_filetomake_fileasalias


onerror

display dialog "A file with the name " & "“" & file_name & "”" & " already exists on the desktop. Please try again." buttons {"OK"} default button 1 cancel button 1 with icon stop


endtry

endtell


tell application "QuickTime Player"


settemp_doctomakenewdocument

endtell


set fol to choose folder with prompt "Choose the folder containing QuickTime files to be merged:"

tellapplication "Finder"


setthe_filestoeveryfileoffolderfol


repeatwithifrom 1 tocountofthe_files


seta_filetoitemiofthe_files


mymerge_files(a_file, temp_doc)


endrepeat

endtell


delay 1


tell application "QuickTime Player"


telldocument 1


select none


saveasself containedinnew_file


close


endtell

endtell


onmerge_files(a_file, temp_doc)

tell application "QuickTime Player"


activate


makenewdocument


opena_file


delay 1


telldocument 1


setttogetduration


setcurrent timetot


select all


copy


close


endtell


activatedocumenttemp_doc


delay 1


telldocument 1


paste


endtell


endtell

endmerge_files


Hope this helps. Good luck.



Applescript for quicktime player 7 in 10.6

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.