Did you check the source of the selected message? Also, instead of comparing the file extension to pdf
, I’d go for the MIME-type.
And then you could, of course, find the two messages with a script like this (JavaScript, I don’t do AS):
(() => {
const app = Application("Mail");
const mailbox = app.accounts['Bru6'].mailboxes['INBOX'];
[247497,246889].forEach(messageID => {
const message = mailbox.messages.whose({id: messageID})[0];
console.log(`${messageID}: ${message.subject()} from ${message.sender()} at ${message.dateReceived()}`);
})
})()
And here’s the AS equivalent
tell application "Mail"
set mbox to mailbox "INBOX" of account "DEVONthink"
set msgIDs to {29870, 29891}
repeat with mid in msgIDs
set msg to item 1 of (messages of mbox whose id is mid)
log (mid & ": " & subject of msg & " from " & sender of msg & " at " & date received of msg) as string
end repeat
end tell