Get Mail Attachment name from selection in Mail

Hello everyone,

I need to get the name of an attachment from the currently selected email message in the application Mail and assign it to a variable.

Something like:

(this dosen’t work but illustrates what I need)


tell application "Mail"
	set currentSelection to selection
	set attachmentName to the name of the mail attachment of currentSelection
end tell

Any help would be greatly appreciated,
CarbonQuark

tell application "Mail"
	set currentSelection to selection
	set thisMessage to item 1 of currentSelection
	set attachmentName to name of mail attachment of thisMessage
end tell

or

tell application "Mail"
	set currentSelection to selection
set attachmentName to name of mail attachment of item 1 of currentSelection
end tell

Mark,

Thanks! That worked!

CarbonQuark