------------------------------------------------------------------------------------------------
try
tell application "Mail"
set selectedMessages to selection
if selectedMessages = {} then error "Oops! No messages are selected."
set mailboxList to mailboxes whose ¬
name is not "Drafts" and ¬
name is not "Notes" and ¬
name is not "Deleted Messages" and ¬
name is not "Outbox"
set mailboxNameList to name of mailboxes whose ¬
name is not "Drafts" and ¬
name is not "Notes" and ¬
name is not "Deleted Messages" and ¬
name is not "Outbox"
# The 'tell me to' is only to maintain focus in the Applescript Editor while editing.
# tell me to
set selectedMailboxName to ¬
choose from list mailboxNameList default items "123net" with prompt "Choose Mailbox:" with title "On My Mac Mailbox List:" with empty selection allowed
if selectedMailboxName is not false and selectedMailboxName is not {} then
set selectedMailboxName to item 1 of selectedMailboxName
repeat with i from 1 to length of mailboxNameList
if item i of mailboxNameList = selectedMailboxName then exit repeat
end repeat
set selectedMailbox to item i of mailboxList
repeat with theMessage in selectedMessages
move theMessage to selectedMailbox
end repeat
end if
end tell
on error eMsg number eNum
set {c, s} to {return, "------------------------------------------"}
set e to s & c & "Error: " & eMsg & c & s & c & "Error Number: " & eNum & c & s
beep
# set the clipboard to e
set dDlg to display dialog e buttons {"Cancel", "Copy", "OK"} default button "OK"
if button returned of dDlg = "Copy" then
set the clipboard to e
end if
end try
------------------------------------------------------------------------------------------------