home *** CD-ROM | disk | FTP | other *** search
/ QuickTime for the Web (2nd Edition) / QuickTime for the Web (2nd Edition).iso / pc / AppleScript / QUICKTIME 5.0.2 SCRIPTS / Script Templates / QT 5 Video Track Template < prev   
Encoding:
Text File  |  2001-06-26  |  2.5 KB  |  73 lines

  1. -- This script will process every track chosen by the user
  2. tell application "QuickTime Player"
  3.     activate
  4.     
  5.     try
  6.         if not (exists movie 1) then error "No movies are open."
  7.         
  8.         stop every movie
  9.         
  10.         -- CHECK FOR THE CORRECT VERSION OF QUICKTIME
  11.         set the QT_version to (the QuickTime version as string)
  12.         set the player_version to (the version as string)
  13.         set the required_version to "5.0.2"
  14.         if (the QT_version is less than the required_version) or ¬
  15.             (the player_version is less than the required_version) then
  16.             set the error_message to "This script requires QuickTime " & the required_version & "  or greater." & ¬
  17.                 return & return & ¬
  18.                 "Current QuickTime Version: " & QT_version & return & ¬
  19.                 "Current QuickTime Player Version: " & player_version
  20.             my upgrade_QT(error_message)
  21.         end if
  22.         
  23.         -- CHECK FOR QUICKTIME PRO
  24.         if QuickTime Pro installed is false then
  25.             set the error_message to "This script requires a QuickTime Pro installation on this system."
  26.             my upgrade_QT(error_message)
  27.         end if
  28.         
  29.         tell movie 1
  30.             -- CHECK IF THE MOVIE IS EDITABLE
  31.             if saveable is false then
  32.                 error "This movie has previously been set so that it cannot be copied, edited, or saved."
  33.             end if
  34.             set the track_list to the name of every track whose kind is "Video"
  35.             if the track_list is {} then error "This movie contains no video tracks."
  36.             set the track_names to ¬
  37.                 choose from list track_list with prompt "Command-click the target track(s):" with multiple selections allowed
  38.             if the track_names is false then error number -128
  39.             
  40.             repeat with i from 1 to the count of the track_names
  41.                 set this_trackname to item i of the track_names
  42.                 tell track this_trackname
  43.                     
  44.                     -- SCRIPT STATEMENTS GO HERE
  45.                     
  46.                 end tell
  47.             end repeat
  48.         end tell
  49.     on error error_message number error_number
  50.         if the error_number is not -128 then
  51.             beep
  52.             display dialog error_message buttons {"Cancel"} default button 1
  53.         end if
  54.     end try
  55. end tell
  56.  
  57. on upgrade_QT(passed_message)
  58.     tell application "QuickTime Player"
  59.         activate
  60.         stop every movie
  61.         set the target_URL to "http://www.apple.com/quicktime/download/"
  62.         display dialog passed_message & return & return & ¬
  63.             "If this computer is currently connected to the Internet, " & ¬
  64.             "click the “Upgrade” button to visit the QuickTime Website." buttons {"Upgrade", "Cancel"} default button 2
  65.         ignoring application responses
  66.             tell application "Finder"
  67.                 open location target_URL
  68.             end tell
  69.         end ignoring
  70.         error number -128
  71.     end tell
  72. end upgrade_QT
  73.