(* You must have PearLyrics installed to launching this script *) set the_result to display dialog ¬ "In iTunes, display the playist to which you want to add lyrics." & return & return & ¬ "Enter the maximum number of seconds you would like to wait." default answer "10" set max_delay to text returned of the_result set start_time to current date tell application "192.168.1.101" to activate tell application "iTunes" activate -- let's not do this forever set orig_repeat to song repeat of view of first window set song repeat of view of first window to none -- pearLyrics requires iTunes to be playing play 1st track of view of 1st browser window repeat set start_date to current date set cur_track to name of current track -- wait 1 second, but no more than max_delay -- check again repeat until (current date) - start_date > max_delay --log "starting " & cur_track if lyrics of current track is "" then delay 1 --log "waiting..." else -- song has lyrics exit repeat end if end repeat next track -- if there is no current track, we must be done. try current track on error exit repeat end try end repeat set song repeat of view of first window to orig_repeat set total_time to (current date) - start_time display alert "Done. Took " & total_time & ¬ " seconds. " as informational end tell