hi all,
i’ve been using the script floating around here to move a message to a specific mailbox for a while http://bbs.applescript.net/viewtopic.php?t=8629 but wanted to know if there was a way to then get the script to finish by returning to the original mailbox and selecting the message after the original message selected.
Here’s what I’ve got:
property target_mailbox : "mailbox"
property target_account : "account"
using terms from application "Mail"
on perform mail action with messages the_selection
if the_selection = {} then
beep
return
end if
tell application "Mail"
set old_mailbox to mailbox of (last item of the_selection)
-- set message_nr to message number in mailbox of (last item of the_selection)
-- set old_account to account of the_selection
repeat with i from 1 to (count of the_selection)
set mailbox of (item i of the_selection) to mailbox target_mailbox of account target_account
end repeat
-- set next_message to message_nr + 1
-- set selection to message next_message in old_mailbox
end tell
end perform mail action with messages
end using terms from
using terms from application "Mail"
on run
tell application "Mail" to set sel to selection
tell me to perform mail action with messages (sel)
end run
end using terms from
the_selection returns something like {message 631 of mailbox “INBOX” of account “account”} – i can get the mailbox name, but how can i get at the number 631 and tell the script to then select message 632 at the conclusion?
any ideas? max