Reputation: 567
This works:
tell application "Mail"
set x to every message in inbox whose subject contains "deal"
end tell
Now I want to do the same using the current selection, but this does not work:
tell application "Mail"
set x to every message in selection whose subject contains "deal"
end tell
getting error
"Mail got an error: Can’t make every message of selection whose subject contains \"deal\" into type specifier." number -1700 to specifier
What am I missing?
Upvotes: 1
Views: 1196
Reputation: 285079
Unfortunately you cannot use the whose
clause on the selection
property.
Workaround is a repeat loop
tell application "Mail"
set theMessages to selection
set filteredMessages to {}
repeat with aMessage in theMessages
if subject of aMessage contains "deal" then set end of filteredMessages to contents of aMessage
end repeat
end tell
Upvotes: 3