Hi All,
Thanks a lot for all your post and contribution, it was really helpfull for a total beginner like me :).
Prior to QT7 i was using this script to create a preview file from the current QuickTime opened movie. The fonction are pretty simple. I need to set a start position and the duration to export. Now QuickTime 7 as come with a lot of new features and that’s great, but… my script did’nt work anymore.
I’m sure this code is … really too noob … I cannot find what is the type problem who break it. I continue to look at “current time” type or something like that, but not sure to find a solution on it.
If someone have an idea, that could be very helpfull for me. Anyway and again thanks a lot for all your posts and contribution. And sorry for my bad frenglish.
tell application "QuickTime Player"
activate
try
if not (exists movie 1) then error "No movies are open."
stop every movie
-- CHECK FOR QUICKTIME PRO
if QuickTime Pro installed is false then
set the target_URL to "http://www.apple.com/quicktime/download/"
display dialog "This script requires QuickTime Pro." & return & return & ¬
"If this computer is currently connected to the Internet, " & ¬
"click the "Upgrade" button to visit the QuickTime Website at:" & ¬
return & return & target_URL buttons {"Upgrade", "Cancel"} default button 2
ignoring application responses
tell application "Finder"
open location target_URL
end tell
end ignoring
error number -128
end if
-- set the position for starting the preview
if not (exists movie 1) then return
stop every movie
set this_movie to the name of movie 1
set the time_scale to the time scale of movie 1
set the play_point to the current time of movie 1
set the high_number to the duration of movie 1
set the low_number to 0
repeat
display dialog "Start position of "" & this_movie & ""." & ¬
return & return & "Enter a number between " & the low_number & " and " & the (round high_number / time scale) & ":" default answer play_point
try
if the text returned of the result is not "" then ¬
set the this_time to the text returned of the result as number
if the this_time is greater than or equal to the low_number and ¬
the this_time is less than or equal to the high_number and ¬
the this_time mod 1 is equal to 0 then
exit repeat
end if
end try
end repeat
set the current time of movie 1 to this_time * time scale
-- set the duration of the preview
set the low_number to 5
set the high_number to 290
repeat
display dialog "Enter a duration between " & the low_number & " and " & the high_number & ":" default answer ""
try
if the text returned of the result is not "" then ¬
set the requested_number to the text returned of the result as number
if the requested_number is greater than or equal to the low_number and ¬
the requested_number is less than or equal to the high_number then exit repeat
end try
end repeat
-- get the name of the movie
set the movie_name to the name of movie 1 & ".preview.wav"
-- check the start and end position for the selection
set the current_time to the current time
select movie 1 at current_time to (current_time + (requested_number * (time scale)))
-- create a new movie and copy the selection inside
copy movie 1
make new movie
paste movie 1
rewind movie 1
select none of movie 1
-- check to see if the opened movie can be exported
if (can export movie 1 as wave) is true then
-- prompt the user for a name and location
set the new_file to ¬
choose file name with prompt "Enter a name and choose a location for the new file:" default name movie_name
-- export the movie as Wave file
export movie 1 to new_file as wave using default settings
-- close the movie
close movie 1 saving no
close movie 1 saving no
else
error "This movie cannot be exported as a Wave Audio Preview."
end if
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
Model: PowerBook
Browser: Safari 417.9.2
Operating System: Mac OS X (10.4)