New to Applescript, and have to say, I’m finding this worse than programming (lol).
Just knocked up a script during the learning phase and can’t, for the life of me, figure out why it continuously repeats.
I want the script to check iTunes is open. Then to send the song details to Xirc (irc client). Then, to check to see if the song has changed, and ONLY WHEN IT DOES, to repeat the process.
iTunes is detected. Song is spammed every 5 seconds, regardless of the proposed wait time.
set itunes_active to false tell application "System Events" if (get name of every process) contains "iTunes" then set itunes_active to true end tell if itunes_active then tell application "iTunes" if player state is playing then set theTrack to name of the current track set theArtist to artist of the current track set theAlbum to album of the current track set theBitrate to bit rate of the current track if theArtist is not "" then set artistinfo to " by " & theArtist else set artistinfo to "" end if if theAlbum is not "" then set Albuminfo to " from the album " & theAlbum else set Albuminfo to "" end if end if repeat if theTrack is not equal to current track then set theTrack to name of the current track set theArtist to artist of the current track set theAlbum to album of the current track set theBitrate to bit rate of the current track set theContents to "is listening to " & theTrack & artistinfo & Albuminfo & " at " & theBitrate & " Kbps" tell application "Xirc" set theString to "/me " & theContents do theString end tell end if delay 5 end repeat end tell end if
Any and all help would be much appreciated,
Model: MacBook Pro 17" IC2D 2.33GHz 2GB Ram 120GB HDDrive
Browser: Firefox 3.0b6
Operating System: Mac OS X (10.4)