[MlMt] Workaround for sending a link from Safari via MailMate

David Shepherdson david at shepherdson.name
Wed Jan 27 00:06:18 EST 2016


On 27 Jan 2016, at 14.59, mailmate-request at lists.freron.com wrote:

> After discovering that the default mail client vicious circle is 
> actually only an El Capitan - bug (see the thread *How to set MailMate 
> (once!) to be the default app for email* - 
> http://lists.freron.com/mailmate/2016-January/005526.html) I made a 
> Keyboard Maestro - macro as a sort of workaround in order to be able 
> to send the link of the current Safari-window / tab via MailMate.


One of the great things about Keyboard Maestro, like MailMate, is that 
there always seem to be numerous ways of achieving the same end. :-)

With that in mind, here's an alternative implementation of the same 
idea, using MailMate's flexible 'perform' AppleScript command and a 
JavaScript bookmarklet so it could work in different browsers.

Keyboard Maestro macro 'New Message with Value':

     (Set variable) valueForMessage
     (to:) %TriggerValue%

     (Execute AppleScript)
     (Execute text script)
     tell application "Keyboard Maestro Engine"
         set valueForMessage to the value of variable "valueForMessage"
     end tell

     tell application "MailMate" to perform {"newMessage:"}
     tell application "MailMate" to perform {"makeFirstResponder:", 
"messageEditor", "insertText:", valueForMessage, "makeFirstResponder:", 
"mainOutline"}


Bookmarklet:

     
javascript:window.location='kmtrigger://macro=New%20Message%20with%20Value&value='+encodeURIComponent(window.location);


The bookmarklet trick means that this can work in browsers with poor 
AppleScript support, like Firefox. :-( For Safari or Chrome, you could 
use either AppleScript or the built-in support in Keyboard Maestro (like 
'Execute a JavaScript in Safari') to get the URL and other attributes of 
the page directly.

David

P.S. As an aside, is there a better way to reply to messages from the 
digest in MailMate than what I did here -- i.e. copying/pasting the 
quoted text and subject line manually, and then being warned by MailMate 
because I changed the subject line in a reply? I tried selecting the 
text in the digest message before replying, in case that gave some 
'clues', but I still only get the digest header and subject in the 
resultant message.


More information about the mailmate mailing list