agent69akasexy
Oct 9, 2009, 12:27 PM
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:
-- 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:"Specific address goes here"}
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:
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
-- 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:"Specific address goes here"}
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:
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
