tell application "iTunes" -- ITUNES VERSION CHECK set this_version to the version as string if this_version is not greater than or equal to the required_version then beep display dialog "This script requires iTunes version: " & required_version & Â return & return & Â "Current version of iTunes: " & this_version buttons {"Update", "Cancel"} default button 2 with icon 2 if the button returned of the result is "Update" then my access_website("http://www.apple.com/itunes/download/") return "incorrect version" end if end if -- get a list of track references set these_tracks to the selection of browser window 1 if these_tracks is {} then error "No tracks are selected in the front window." -- check for an iPod if the kind of container of view of browser window 1 is iPod then error "This script cannot delete files from an iPod." end if -- Loop through selected files set these_files to {} -- get the file path of each of the selected tracks repeat with i from 1 to the count of these_tracks set this_track to item i of these_tracks if the location of this_track is not missing value then set the end of these_files to (the location of this_track) end if end repeat end tell -- Activate QuickTime, and play selected item: tell application "QuickTime Player" activate -- delete the files set the item_counter to 0 repeat with i from 1 to the count of these_files set this_file to (item i of these_files) as alias open this_file set the item_counter to the item_counter + 1 end repeat end tell -- Play front-most item: tell application "QuickTime Player" tell movie 1 rewind play end tell end tell on error error_message number error_number if the error_number is not -128 then tell application "iTunes" activate beep display dialog error_message buttons {"Cancel"} default button 1 end tell end if end try