I’m working on my first Applescript … so please excuse any ignorance … this script will eventually get the email address of the sender of each selected message, look it up in and get the ‘full name’ (first + last name) from Address Book, look for a mailfolder with this name in Mail and if it’s there, move the message to this folder.
So … step 1: get the email address of the send of each selected message … I wrote the following:
using terms from application “Mail”
on perform mail action with messages theSelectedMessages
tell application “Mail”
if (count of theSelectedMessages) is equal to 0 then
display dialog “Please select a message in Mail first, then run this script again.”
else if (count of theSelectedMessages) is greater than 0 then
display dialog “Good, you selected some messages. Let’s see …” & return
repeat with eachMessage in theSelectedMessages
set theSender to address of sender of eachMessage
display dialog theSender & return
end repeat
display dialog “done.”
end if
end tell
end perform mail action with messages
end using terms from
Which (when messages are selected) returns the ‘Good, …’ line … and then nothing.
What am I doing wrong?