Even though I've had KM for a bit now, I'm still relatively new. Today I've tried to work on a series of actions using macmail, one of which will use the subject of a reply-mail, but I'm finding that when I try to use %MailSubject% it's drawing on the information of the mail selected in the main window behind it, not the active reply window. So if for some reason the main window is minimized, or there's more than one window, the series of actions don't work.
Is there a solution to this? I've looked but can't see one (well, one within my scope of comprehension anyway).
The Apple Mail Reply window is NOT available to normal scripting, so KM doesn't have any access to it.
However, this UI script should return the Subject of the open Apple Mail Reply Message that currently has focus. Just put this script in a KM Execute an AppleScript action, and set the results to a KM Variable of your choosing.
property ptyScriptName : "Get Subject of Apple Mail Reply Message"
property ptyScriptVer : "2.0"
property ptyScriptDate : "2018-06-30"
property ptyScriptAuthor : "JMichaelTX"
tell application "System Events"
tell application process "Mail"
tell (first window whose subrole is "AXStandardWindow")
tell text field "Subject:"
set subjectStr to its value
Here is a list of all UI elements of the Mail Reply Window.
Using this data, you should be able to construct a UI script addressing any of these elements.
application Process "Mail"
window Re: test from outlook
static text "To:"
text field "To:"
text field 1
static text "Cc:"
text field "Cc:"
static text "Subject:"
text field "Subject:"
scroll area 1
UI element 1
static text "On Nov 9, 2012, at 3:16 PM, FirstName LastName <SomeName@SomeDomain.com> wrote:"
static text "This is a test."
static text "Best Regards,"
static text " "
static text "FirstName LastName"
radio button "Re: test from outlook"
button "close tab"
menu button 1
menu button 1
You've been really helpful. I didn't catch the extra submenu - I was thinking that I had to do something with your result as a step. This link spelt it out for me Variable: Applescript to KM where he points out the submenu. All good now - I've got it going to a clipboard.
Again, really appreciate your help - it's a great community here.