1

Very new to AppleScript and hoping someone can help. I use an AppleScript which I got on the MacSparky website which uses URL Schemes and AppleScript to create a link to a highlighted email in macOS mail app. I can paste this into certain task managers as a link back to the email etc. It works great. However, I've started using Notion and Notion doesn't support these URL schemes. It will paste the URL into Notion as a text string but its not clickable.

So, basically pointless.

I also use Keyboard Maestro a lot and was thinking that if I created a KM routine to do the following, it would be a simple workaround.

1 - double click the text string (easy)

2 - copy it to the clipboard (easy)

3 - run an AppleScript to open the email using the clipboard contents. (no clue)

However, I have no idea what to script to make number 3 above happen.

Presuming its "get clipboard" and pass this through to mail app, tell "mail" to "open this URL". etc. I've messed around for about an hour with no success.

Although, I'm convinced its a simple script. It eludes me!

Any help appreciated!!

Thanks.

This probably makes no sense but indicative of where I'm at....

set MessageID to "clipboardText" 
  tell application "Mail" 
   activate open (first message of inbox whose message id = "clipboardText") 
end tell 
0

1 Answer 1

1

Resolved via a Redditor

tell application "Finder" to open location (the clipboard)

Simples!

So, this will work for applications that don't work with URL schemes natively. Simply paste in the message URL. And when you want to retrieve or activate it, select the whole URL and run this command. Its not a perfect solution but it works just fine. And, makes Notion far more useful in my workflow now that I can pepper email links throughout and actually recall and open those emails when I want.

1
  • you could skip the clipboard step. AppleScript can receive URLs the same way a browser (or any other application) would. The AppleScript syntax is: on open location thisUrl. Then configure KM to use the AppleScript application for the Open URL action.
    – WindChimes
    May 30, 2023 at 9:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .