Currently, to identify a selected message in Mail, I use the following method:
tell application "Mail"
set the_selection to selection
set the_msg to get item 1 of the_selection
end tell
The result is something like:
message id 66888 of mailbox “INBOX” of account “wladdy.com” of application “Mail”
This allows me to manipulate the message the_msg and works well enough.
However, being a beginner, I feel that I am missing a simpler single-line approach.
For instance, why does this :
tell application "Mail"
set the_msg to get item 1 of selection
end tell
not work and return the following error message ?
error “Mail got an error: Can’t make item 1 of selection into type specifier.” number -1700 from item 1 of selection to specifier
Any suggestion would help me better understand AppleScript and would be greatly appreciated. Thanks. W.