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


Click here to return to the 'Add iTunes song info to your AIM profile' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Add iTunes song info to your AIM profile
Authored by: mproud on Feb 26, '04 06:11:48AM
This works, folks. And well. Might have a little trouble on exit, and it makes a brave attempt at preserving the previous profile. Anyway, the key is using terms from - that's necessary to actually get at the set profile command in AIM.
tell application "AOL Instant Messenger (SM)"
	using terms from application "AOL Instant Messenger (SM)"
		set lastProfile to profile
	end using terms from
end tell

idle {}

on idle {}
	tell application "Finder"
		if (not (exists process "iTunes")) or (not (exists process "AOL Instant Messenger (SM)")) then
			idle
		end if
	end tell
	update()
end idle

on update()
	try
		tell application "iTunes"
			if player state is playing then
				set trackName to name of current track
				set trackAlbum to album of current track
				set trackArtist to artist of current track
			else if player state is paused or player state is stopped then
				try
					using terms from application "AOL Instant Messenger (SM)"
						tell application "AOL Instant Messenger (SM)"
							set profile to lastProfile
						end tell
					end using terms from
				on error
					idle
				end try
				idle
			else if player state is fast forwarding or player state is rewinding then
				set trackName to name of current track
				set trackAlbum to album of current track
				set trackArtist to artist of current track
				
				repeat while player state is fast forwarding or player state is rewinding
				end repeat
				set trackName to name of current track
				set trackAlbum to album of current track
				set trackArtist to artist of current track
			end if
		end tell
		
		try
			using terms from application "AOL Instant Messenger (SM)"
				tell application "AOL Instant Messenger (SM)"
					set profile to "Now playing" & return & trackName & return & trackAlbum & return & trackArtist
				end tell
			end using terms from
		end try
		try
			tell application "iTunes" to delay (duration of current track) - player position
		on error
			tell application "Finder"
				using terms from application "AOL Instant Messenger (SM)"
					set profile to lastProfile
				end using terms from
			end tell
			idle
		end try
	on error
		idle
	end try
	update()
end update


[ Reply to This | # ]