I wrote a short Applescript to move the selected messages to the relevant archive for that mailbox. However when it runs there is no longer a selection. (If I then press up or down, it selects either the first or last message in the entire mailbox). I can’t work out how to select the next message outside of the current selection using AppleScript. I don’t really mind whether ‘next’ is the message before or after as long as it is near the selection (which is about to disappear).
If it helps, here is my Applescript:
tell application 'Mail' set selectedMessages to selection repeat with theMessage in selectedMessages set theAccount to account of mailbox of theMessage set read status of theMessage to true set mailbox of theMessage to mailbox '_old' of theAccount end repeat end tell
Try something like this:
Note that this assumes a few things—only one mailbox is selected, you’re not moving the last message, and so forth.