Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

agent69akasexy

macrumors newbie
Original poster
Oct 9, 2009
1
0
I am trying to make an applescript (triggered by a rule) that sends the sender the current track playing in itunes. I have the code that sends a specific address the information:

Code:
-- Email Me What Song Is Playling

tell application "iTunes"
	set trk_arts to the artist of the current track
	set trk_name to the name of the current track
	set playlisto to the name of the current playlist
	
end tell


tell application "Mail"
	delay 3
	set theMessage to make new outgoing message with properties {visible:true, subject:"Answer:", content:"The Current Track is \"" & trk_name & "\" by " & trk_arts & ". iTunes is currently in the playlist \"" & playlisto & "\""}
	tell theMessage
		make new to recipient with properties {address:"[B][I]Specific address goes here[/I][/B]"}
	end tell
	send theMessage
end tell

but, i cant figure out how to make sure that email is sent back to the person that sent the email that the rule is evaluating. So far i've got this:

Code:
using terms from application "Mail"
	
	tell application "iTunes"
		set trk_arts to the artist of the current track
		set trk_name to the name of the current track
		set playlisto to the name of the current playlist
		
	end tell
	
	delay 3
	
	on perform mail action with messages theMessages for rule theRule
		tell application "Mail"
			repeat with thisMessage in theMessages
				set sender_ to sender of thisMessage
				set address_ to extract address from sender_
				
				set theNewMessage to make new outgoing message with properties {visible:true, subject:"Answer:", content:"The Current Track is \"" & trk_name & "\" by " & trk_arts & ". iTunes is currently in the playlist \"" & playlisto & "\""}
				tell theNewMessage
					make new to recipient with properties {address:sender_}
				end tell
				
				send theNewMessage
			end repeat
		end tell
	end perform mail action with messages
end using terms from
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.