Hi I need a little help making this script work better. What I want it to do is ask you to choose a quicktime to open and then proceed to grab random frames from the quicktime movie and save them to a folder of your choosing.
Any help that you can give is appreciated.
Thanks.
set theDefaultDir to path to desktop folder as alias
tell application "Finder"
if exists folder "movpicts" of theDefaultDir then
delete folder "movpicts" of theDefaultDir -- moves to trash
end if
set TheImagetank to (make new folder at theDefaultDir with properties {name:"movpicts"})
end tell
choose file with prompt "choose movies to grab frames from:" with multiple selections allowed without invisibles
open result
on open droppedItems
tell application "QuickTime Player"
activate
end tell
end open
tell application "QuickTime Player"
activate
try
if not (exists document 1) then error "No movies are open."
stop every document
try
--set this_name to the full text of annotation "Full Name"
set this_name to the name of document 1
set bla to ((length of this_name) - 4)
set this_name to (characters 1 thru bla of this_name) as string
on error
set this_name to bla
end try
set movie_scale to the time scale of document 1
set eerste_stap to 1 * movie_scale --2 sec
set aantal_stappen to ((duration of document 1) - eerste_stap) / 8
--set the destination_folder to theDir
rewind document 1
set current time of document 1 to eerste_stap
set this_file to (this_name & "-1.jpg")
set the target_file to ((TheImagetank as string) & this_file)
set the chosen_preset to "Photo-JPEG"
export document 1 to target_file as picture using settings preset chosen_preset with replacing
set current time of document 1 to eerste_stap + (1 * aantal_stappen)
set this_file to (this_name & "-2.jpg")
set the target_file to ((TheImagetank as string) & this_file)
set the chosen_preset to "Photo-JPEG"
export document 1 to target_file as picture using settings preset chosen_preset with replacing
set current time of document 1 to eerste_stap + (2 * aantal_stappen)
set this_file to (this_name & "-3.jpg")
set the target_file to ((TheImagetank as string) & this_file)
set the chosen_preset to "Photo-JPEG"
export document 1 to target_file as picture using settings preset chosen_preset with replacing
set current time of document 1 to eerste_stap + (3 * aantal_stappen)
set this_file to (this_name & "-4.jpg")
set the target_file to ((TheImagetank as string) & this_file)
set the chosen_preset to "Photo-JPEG"
export document 1 to target_file as picture using settings preset chosen_preset with replacing
set current time of document 1 to eerste_stap + (4 * aantal_stappen)
set this_file to (this_name & "-5.jpg")
set the target_file to ((TheImagetank as string) & this_file)
set the chosen_preset to "Photo-JPEG"
export document 1 to target_file as picture using settings preset chosen_preset with replacing
set current time of document 1 to eerste_stap + (5 * aantal_stappen)
set this_file to (this_name & "-6.jpg")
set the target_file to ((TheImagetank as string) & this_file)
set the chosen_preset to "Photo-JPEG"
export document 1 to target_file as picture using settings preset chosen_preset with replacing
set current time of document 1 to eerste_stap + (6 * aantal_stappen)
set this_file to (this_name & "-7.jpg")
set the target_file to ((TheImagetank as string) & this_file)
set the chosen_preset to "Photo-JPEG"
export document 1 to target_file as picture using settings preset chosen_preset with replacing
set current time of document 1 to eerste_stap + (7 * aantal_stappen)
set this_file to (this_name & "-8.jpg")
set the target_file to ((TheImagetank as string) & this_file)
set the chosen_preset to "Photo-JPEG"
export document 1 to target_file as picture using settings preset chosen_preset with replacing
close document 1 saving no
on error error_message number error_number
if the error_number is not -128 then
beep
display dialog error_message buttons {"Cancel"} default button 1
end if
end try
end tell