Puzzled about this syntax problem: these two snippets work fine:
tell application "Mail"
set x to selection
end tell
==> {
message id 27754 of mailbox “INBOX” of account “JL@mac” of application “Mail”
}
tell application "Mail"
set x to selected messages of first message viewer
end tell
==> {
message id 27754 of mailbox “INBOX” of account “JL@mac” of application “Mail”
}
However, the next two, trying to set the selection to a particular message ID using the exact syntax returned by the above snippets, do not compile:
tell application "Mail"
set selection to (message id 27754 of mailbox "INBOX" of account "JL@mac")
end tell
==> Applescript Syntax Error: Expected ", " but found number. (“27754” is highlighted)
tell application "Mail"
set selected messages of first message viewer to (message id 27754 of mailbox "INBOX" of account "JL@mac")
end tell
==> Applescript Syntax Error: Expected ", " but found number. (“27754” is highlighted)
However, the following works just fine, setting the selection to null, and then back to what it was:
tell application "Mail"
set x to selected messages of message viewer 1
set selected messages of message viewer 1 to {}
set selected messages of message viewer 1 to x
end tell
Anybody know what gives here? Why is the construct "message ID nnnnn of mailbox “INBOX” of account “JL@mac” " a syntax error, when that is what is returned from a “get selection”?