Hi,
I knocked up this simple script which does three things:
- Clears any flag from the highlighted email in Mail (5.0, running in Lion, 10.7)
- Moves the email to the Archive folder for the relevant email account
- Selects the email below the email that has just been archived
tell application "System Events"
tell process "Mail"
tell menu bar 1
tell menu bar item "Message"
tell menu "Message"
tell menu item "Flag"
tell menu "Flag"
click menu item "Clear Flag"
end tell
end tell
click menu item "Archive"
end tell
end tell
end tell
end tell
keystroke (key code 125)
end tell
The problem is that about every other time I run the script it crashes Mail, seemingly at the point that it is performing the keystroke.
Does anyone have any idea why and what I could do to solve the issue?
Thanks,
Nick