You can do some magic with AppleScript and System Events.
This will create a new message and set the To-Address.
It will then move focus to the body of the message, so you can use KM to paste there.
------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2015/10/03 06:00
# dMod: 2015/12/04 04:27
# Appl: Mail & System Events
# Task: Create New Mail Message, set To-Field, move focus into body (for pasting).
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @Mail, @System_Events
------------------------------------------------------------
tell application "Mail"
activate
set newMsg to make new outgoing message with properties {visible:true}
end tell
tell application "System Events"
if quit delay ≠ 0 then set quit delay to 0
tell application process "Mail"
set frontmost to true
tell (first window whose subrole is "AXStandardWindow")
delay 0.05
# Comment-out to leave To field unchanged.
tell text field "To:"
set value to ""
set focused to true
set value to "Robert A. Heinlein <tanstaafl@pieinthesky.com>"
end tell
# Moves focus to the message body.
tell scroll area 1 to tell UI element 1 to set focused to true
end tell
end tell
end tell
------------------------------------------------------------
This is a simple example – quite a lot more can be done.
AppleScripts can be tested with the Script Editor.app – and run from Keyboard Maestro using an Execute an AppleScript action.
I’m still looking into the issue of creating the message fully with AppleScript (ASObjC in this case).
-Chris
Edited 2015/12/04 04:27 – changed script to ensure Mail is activated.