#1200 new
Robert Black

Request a new key binding: getSelectedMessage

Reported by Robert Black | July 8th, 2015 @ 10:56 PM

Please consider the addition of a new key binding to allow extraction of message data from the currently selected message:

Selector: "getSelectedMessage:"
Argument: Option string (Optional)
Action: Returns full raw message as string if no argument is set. Optional argument strings for returning different data from the message: raw, html, sendername, senderaddress, senderraw, text, subject.

The main use of this new keybinding would be to allow new functionality via AppleScript and the perform command.

For example:

tell application "MailMate" to set my_subject_variable to perform {"getSelectedMessage:", "subject"}

Edge cases: If no messages are selected, the string returned is always "". If more than one message is selected, only return information from the first message. If more than one Viewer Window is open, apply this to the frontmost window.

Rationale: The addition of this key binding would extend the scriptability of MailMate to allow the extraction of message data into other applications, using AppleScript to interact with MailMate via keybindings as they appear to be the preferred method of extending MailMate functionality.

Cheers
Robert Black

Comments and changes to this ticket

  • Robert Black

    Robert Black July 9th, 2015 @ 12:37 AM

    Examples of utility:

    I often email a link to interesting articles to myself and I have a keyboard triggered AppleScript that opens the first url found in the current message...

    tell application "MailMate"
        set c to perform {"getSelectedMessage:", "text"}
    end tell
    set u to find text "((http|https)://[-a-zA-Z0-9&=%/._?,]*)" in c with regexp and string result
    open location u
    tell application "MailMate"
        activate
    end tell
    

    This allows me to quickly move down a list of messages opening up articles I've emailed to myself using just the keyboard.

    Or there's this script, which imports the notification details of a new subscriber for my newsletter into FileMaker:

    tell application "MailMate"
        set c to perform {"getSelectedMessage:", "text"}
    end tell
    if c does not contain "email:" then
        return
    end if
    
    try
        set n_f to find text "name_first:\\s*([\\S]*)\\s*" in c using "\\1" with regexp and string result
    on error
        set n_f to ""
    end try
    try
        set e_m to find text "email:\\s*([\\S]*)\\s*" in c using "\\1" with regexp and string result
    on error
        set e_m to ""
    end try
    try
        set f_b to find text "feedback:\\s*(.*)\\s*$" in c using "\\1" with regexp and string result
    on error
        set f_b to ""
    end try
    
    tell application "FileMaker Pro"
        set current layout of front window to layout named "Email_Subs"
        cell named "sub_yaml" of current record of layout named "Email_Subs"
        set n_r to create new record in layout named "Email_Subs"
        set current record in layout named "Email_Subs" to n_r
        set cell named "yaml" of current record of layout named "Email_Subs" to c
        set cell named "name_first" of current record of layout named "Email_Subs" to n_f
        set cell named "emailAddress" of current record of layout named "Email_Subs" to e_m
        set cell named "feedback" of current record of layout named "Email_Subs" to f_b
    end tell
    
  • Mike Petonic

    Mike Petonic May 26th, 2016 @ 01:19 AM

    I want to second this request. I'm moving some functionality that I'd built up around Mail.app over to MailMate. Being able to get access to the properties of the selected message would be powerful indeed.

    Thanks!

  • Carlos

    Carlos June 2nd, 2016 @ 07:04 PM

    I'd like to second (third?) this request as well. In my case, I'm looking for the ability to answer some email using a template. That is, I'd like to set a shortcut that would open the selected email, get the name of the sender, insert that into a template, and leave the compose window open for editing.

    Thanks.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Mac OS X email client.

Shared Ticket Bins

People watching this ticket

Pages