GETting the mailbox of a selected message
GETting the mailbox of a selected message
- Subject: GETting the mailbox of a selected message
- From: Lee Noble <email@hidden>
- Date: Fri, 22 Oct 2004 14:40:01 +0100
Hi all,
I have written this script to merge threads and rename email subjects.
It works perfectly...when used in my inbox however I would like it to
work in any mailbox. The crucial line is 5 from the bottom, the move
message line which is necessary to fix the changes in place and refresh
the message list to reflect the changes.
tell application "Mail"
set theSubjectList to {}
set headList to {}
set themessages to selection as list
set messageTitle to button returned of (display dialog "Thread name…"
buttons {"New", "Select From Existing…"} default button 2)
repeat with msg in themessages
set theHeaders to headers of msg as list
set thisSubject to (subject of msg as string)
repeat with head in theHeaders
if (name of head as string is "Thread-Topic") and (content of head
as string is not in theSubjectList) then
set theSubjectList to theSubjectList & {(content of head as string)}
else if thisSubject is not in theSubjectList then
set theSubjectList to theSubjectList & {thisSubject}
end if
end repeat
if thisSubject is not in theSubjectList then
set theSubjectList to theSubjectList & {thisSubject}
end if
end repeat
if messageTitle is "New" then
set theNewSubject to (text returned of (display dialog "Type new
subject" default answer "NEW THREAD")) as string
else
set theNewSubject to (choose from list theSubjectList with prompt
"Choose the subject of the merged thread…") as string
end if
if theNewSubject is not "false" then
repeat with msg in themessages
set subject of msg to (theNewSubject)
end repeat
move msg to mailbox "INBOX" of account of mailbox of msg -- this line
needs fixing
(*
something like
move msg to mailbox of msg
seems appropriate but doesn't work.
*)
else
display dialog "Action cancelled"
end if
end tell
How do I get the current message mailbox?
It's frustrating because when the error message pops up it actually
writes out the path to the mailbox.
Any help appreciated.
Lee
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden