This AppleScript will select all the duplicate messages in the currently open Message Viewer window in Mail.app.
To use this script:
- Open up Script Editor and paste the code into a new window.
- Save it somewhere convenient, like the Desktop or if you have your Scripts menubar item activated, under ~/Library/Scripts.
- Open up Mail 2.0 and select the mailboxes to scan so the message list displays all the messages you want to scan.
- Run the script. When the script is finished, a notification dialog will popup.
- Move the selected duplicate messages to the Trash or do anything else with them.

