User "lee1210"gets the credit for the following script. Given that it is almost what I need, I thought I'd make a new post to finish the script.
Need: Plug in the email address of a particular sender and from all emails from that sender create one event for each email. The script below works, but only for the first email it encounters.
I have 6 email accounts, so I need all my inboxes and out boxes searched by sender or recipient for this script. I suspect only one of my inbox accounts is being searched as well.
LASTLY (and not addressed in the script below) I need the event to hyperlink to the email that geneerated the event or, ideally, create a pdf, in a designated folder on he desktop of the email that created the event (perhaps putting the date and sender as the document name) and link the event to that.
Again, thank you "lee1210" for doing what no one else could thus far. If Lee or anyone else can finish this script, I'd be grateful.
P
Lee's script:
display dialog "Address to generate events for: " default answer "user@domain.com"
set diagRet to result
set searchString to text returned of diagRet
tell application "Mail"
set myInbox to mailbox "INBOX" of account 1
set myMessages to every message of myInbox where sender is searchString
repeat with theMessage in myMessages
set alt to sender of theMessage
set sdr to sender of theMessage
set dt to date received of theMessage
set sm to id of theMessage
set sub to subject of theMessage
tell application "iCal"
set myCal to calendar "Test"
make new event at the end of events of myCal with properties {summary:"Email from " & sdr & ": " & sub, description:sm as text, start date:dt, end date:dt}
display dialog ("Creating " & dt)
end tell
end repeat
end tell
Need: Plug in the email address of a particular sender and from all emails from that sender create one event for each email. The script below works, but only for the first email it encounters.
I have 6 email accounts, so I need all my inboxes and out boxes searched by sender or recipient for this script. I suspect only one of my inbox accounts is being searched as well.
LASTLY (and not addressed in the script below) I need the event to hyperlink to the email that geneerated the event or, ideally, create a pdf, in a designated folder on he desktop of the email that created the event (perhaps putting the date and sender as the document name) and link the event to that.
Again, thank you "lee1210" for doing what no one else could thus far. If Lee or anyone else can finish this script, I'd be grateful.
P
Lee's script:
display dialog "Address to generate events for: " default answer "user@domain.com"
set diagRet to result
set searchString to text returned of diagRet
tell application "Mail"
set myInbox to mailbox "INBOX" of account 1
set myMessages to every message of myInbox where sender is searchString
repeat with theMessage in myMessages
set alt to sender of theMessage
set sdr to sender of theMessage
set dt to date received of theMessage
set sm to id of theMessage
set sub to subject of theMessage
tell application "iCal"
set myCal to calendar "Test"
make new event at the end of events of myCal with properties {summary:"Email from " & sdr & ": " & sub, description:sm as text, start date:dt, end date:dt}
display dialog ("Creating " & dt)
end tell
end repeat
end tell