Move message to saved___cmd-d (AppleScript) |
Saturday, February 26, 2005 |
(* -- this should work, but doesn’t using terms from application "Mail" on perform mail action with messages selectedMessages moveMessages(selectedMessages) end perform mail action with messages end using terms from *) on moveMessages(selectedMessages) try -- move down to next message tell application "System Events" to tell process "Mail" to key code 125 tell application "Mail" local theMessage, savedName, theMailbox local uiucInbox, sabiInbox, uiucSaved, sabiSaved set uiucInbox to mailbox "INBOX" of account "UIUC" set sabiInbox to mailbox "+/INBOX" of account "UIUC" set savedName to my yearMonth() set uiucSaved to mailbox savedName of account "UIUC" set sabiSaved to mailbox ("+/" & savedName) of account "UIUC" repeat with theMessage in selectedMessages if theMessage's mailbox is uiucInbox then move theMessage to uiucSaved else if theMessage's mailbox is sabiInbox then move theMessage to sabiSaved else display dialog "Can’t file message “" & theMessage's subject & ¬ "” because its containing mailbox is not one of the UIUC or sabi.net inboxes." buttons ¬ {"Cancel", "Skip"} default button 2 end if end repeat end tell on error ee number en if en ≠ -128 then display dialog ee & " " & en buttons {"Cancel"} end try end moveMessages on yearMonth() local theDate, yearMonth set theDate to current date set yearMonth to theDate's month as number as string if length of yearMonth is 1 then set yearMonth to "0" & yearMonth return (theDate's year as number as string) & "-" & yearMonth end yearMonth on run tell application "Mail" to my moveMessages(selected messages of front message viewer) end run |
|
Top | Made with Script Debugger 3.0 |