Productivity

Get an Email URL from Airmail 3

Just like Apple Mail, the Airmail 3 app has the ability to create an “URL” for each Email message.  This is important if, like me, you like to reference Email messages in other apps like Evernote or other project and time management apps.  I personally use a Tiddlywiki ToDo setup where I just paste in message URLs into my ToDo items so I can always call them up later.

The trick, however, is how to get that message URL??  There are several Applescripts for getting message URLs from Apple Mail, but I could not find one for Airmail….so I sat down this afternoon and create one.

Here it is:


-- Get Airmail 3 EMail URL
tell application "Airmail 3"
   set x to the count of the selected message
   if x is 0 then
       display alert "Airmail 3" message "No message selected!"
       return
   end if

   set theURL to the selectedMessageUrl

   set theMessage to selected message
   tell theMessage
      set theSubject to subject
   end tell

   set the clipboard to "__Email__:" & theSubject & ": “ & theURL
   return theURL
end tell

Its actually pretty simple.  The script first checks to see if a message has actually been selected.  If so, then grab the selectedMessageUrl attribute, and store it to the clipboard.

I set my script up as an Alfred Workflow, so its pretty simple to get.  Once I have it, I can just paste it into my ToDo list.

 

Related posts