Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Use AppleScript to create QuickTime transcription aids' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Use AppleScript to create QuickTime transcription aids
Authored by: ptamas on Sep 16, '03 08:51:13PM

Working with Keyboard Maestro I've come up with the following...it uses time displacement rather than fastforward and rewind (step forward about 3 second, step back about 3 seconds etc.) and one script copies the timecode to the clipboard...it takes a two step macro to make that one work (explained below)
here they are

step forward
tell application "QuickTime Player"
if the movie 1 is playing then
step forward movie 1 by 10
play movie 1
else
step forward movie 1 by 10

end if


end tell

step backward
...just edits two lines replacing
step forward movie 1 by 10
with
step backward movie 1 by 10

play pause looks like this

tell application "QuickTime Player"
if the movie 1 is playing then
stop movie 1
step backward movie 1 by 5
else
play movie 1
end if
end tell

now the brute is inserting the timecode...the macro for keyboard maestro set up for TAMS looks like this
1. run the 'timecode' Apple Script
2. Insert Text '{timecode}%CurrentClipboard%{/timecode}

and the script looks like this

tell application "QuickTime Player"
try
if not (exists movie 1) then error "No movies are open."

-- CHECK FOR THE CORRECT VERSION
set QT_version to (QuickTime version as string)
set player_version to (version as string)
if (QT_version is less than "5.0") or
(player_version is less than "5.0") then
error "This script requires QuickTime 5.0 or greater." &
return & return &
"Current QuickTime Version: " & QT_version & return &
"Current QuickTime Player Version: " & player_version
end if

-- 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 this_movie to the name of movie 1
set this_time to the current time of movie 1
set movie_scale to the time scale of movie 1
set this_timecode to my time2timecode(this_time, movie_scale)
set the clipboard to this_timecode
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

on time2timecode(this_time, movie_scale)
set the total_seconds to this_time div movie_scale
set the partial_seconds to this_time mod movie_scale

set hours2 to total_seconds div 3600
set hours1 to my add_leading_zeros(hours2, 1)
set minutes2 to (total_seconds - (hours2 * 3600)) div 60
set minutes1 to my add_leading_zeros(minutes2, 1)
set seconds2 to (total_seconds - (minutes2 * 60)) div 1
set seconds1 to my add_leading_zeros(seconds2, 1)
set partial_seconds to my add_leading_zeros(partial_seconds, 2)

set AppleScript's text item delimiters to ":"
set new_timecode to {hours1, minutes1, seconds1} as string
set AppleScript's text item delimiters to ""
set new_timecode to (new_timecode & "." & partial_seconds) as string

return ("[" & new_timecode & "]") as string
end time2timecode

on add_leading_zeros(this_number, max_leading_zeros)
set the threshold_number to (10 ^ max_leading_zeros) as integer
if this_number is less than the threshold_number then
set the leading_zeros to ""
set the digit_count to the length of ((this_number div 1) as string)
set the character_count to (max_leading_zeros + 1) - digit_count
repeat character_count times
set the leading_zeros to (the leading_zeros & "0") as string
end repeat
return (leading_zeros & (this_number as text)) as string
else
return this_number as text
end if
end add_leading_zeros

there...that is it. This last script is a crib from the scripts available from apple.com

-peter




[ Reply to This | # ]