I’m just getting started, so this is probably user error, but I have a link I’ve added to Things, and when I click on that link it’ll first open the Apple Mail app to wherever it was last time I used it, next click of the link takes me to the specific message, which is what I actually want and then alternates between the two with each subsequent click. Is there a way to make it open the specific message every time?
It does seem a little random. I closed down Mail, then clicked on the link in Things. This opened the Mail app, with the linked message in a window on the side, which is fine. I then closed the specific Mail message, clicked the link in Things again, and it just brought the Mail app to the foreground with a different message highlighted (and not open to the side).
Hope this helps - let me know if you need any more info. If I can get this working, it’d be a huge help as I’m moving to a different email provider which doesn’t currently have a Snooze function.
Update: I’ve updated my MacBook Air to Sonoma 14.1.1 and have the same problem. Also, the problem exists wherever I paste the Hookmark link to, so it’s not specific to Things.
Could you please replace the script in Hookmark → Preferences->Scripts->Mail->Open Item with the script below? Then click the save button and give it a try. Please wait several(3-7) seconds and see if the mail is opened.
Thank you
Summary
set MessageID to "$0"
set MessageID to text 9 thru -1 of MessageID
set MessageID to encodeText(MessageID, true, false)
tell application "Mail"
activate
delay 2
try
set myurl to "open -a Mail \"message:%3c" & MessageID & "%3e\""
do shell script myurl
on error eStr number eNum
display dialog eStr & " Number: " & eNum buttons {"OK"} default button 1
return
end try
end tell
on encodeText(theText, encodeCommonSpecialCharacters, encodeExtendedSpecialCharacters)
set theStandardCharacters to "abcdefghijklmnopqrstuvwxyz0123456789%"
set theCommonSpecialCharacterList to "$+!'/?;&@=#%><{}\"~`^\\|*"
set theExtendedSpecialCharacterList to ".-_:"
set theAcceptableCharacters to theStandardCharacters
if encodeCommonSpecialCharacters is false then set theAcceptableCharacters to theAcceptableCharacters & theCommonSpecialCharacterList
if encodeExtendedSpecialCharacters is false then set theAcceptableCharacters to theAcceptableCharacters & theExtendedSpecialCharacterList
set theEncodedText to ""
repeat with theCurrentCharacter in theText
if theCurrentCharacter is in theAcceptableCharacters then
set theEncodedText to (theEncodedText & theCurrentCharacter)
else
set theEncodedText to (theEncodedText & encodeCharacter(theCurrentCharacter)) as string
end if
end repeat
return theEncodedText
end encodeText
on encodeCharacter(theCharacter)
set theASCIINumber to (the ASCII number theCharacter)
set theHexList to {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"}
set theFirstItem to item ((theASCIINumber div 16) + 1) of theHexList
set theSecondItem to item ((theASCIINumber mod 16) + 1) of theHexList
return ("%" & theFirstItem & theSecondItem) as string
end encodeCharacter