Use AppleScript to save an attachment in broken

Number:rdar://9909616 Date Originated:
Status:Duplicate/9731063 Resolved: Product Version:Version 5.0 (1244.2/1244.3)
Classification:Serious Bug Reproducible:Always
It's not possible anymore to use AppleScript to save an attachment of a mail message.

Steps to Reproduce:
Run the following AppleScript.

set theOutputFolder to (choose folder) as string
tell application "Mail"
	set theMessages to selection
	repeat with theMessage in theMessages -- loop through the messages sent by Mail
		set theAttachements to mail attachments of theMessage
		repeat with anAttachment in theAttachements
			--			try
			set theSavePath to theOutputFolder & name of anAttachment
			save anAttachment in theSavePath
			--			end try
		end repeat
	end repeat
end tell

Expected Results:
The attachments of the selected mail of are saved in the selected directory.

Actual Results:
You get an error:
error "Mail got an error: AppleEvent handler failed." number -10000

Broken in Lion 10.7, build 11A511.
Was working on Snow Leopard.
Exact release of the regression in Lion (DP or GM) is unknown.

AppleScript file attached.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!