OmniFocus: New Task for Selected Mail Message
This “macOS only” shortcut uses an AppleScript script to extract information about the currently selected Mail message, and pass it to the shortcut as a Dictionary.
The passed data is then used to create a new task in OmniFocus with the subject of the selected Mail message becoming the title of the created task. In addition, a link to the selected Mail message is placed in the note of the newly created task.
AppleScript: Pass Dictionary of Selected Message
tell application "Mail"
set msgs to selected messages of front message viewer
if (count of msgs) is 1 then
set selMsg to item 1 of msgs
set msgID to message id of selMsg
set msgURL to "message:%3C" & msgID & "%3E"
set msgTitle to subject of selMsg
return "{\"msgURL\":\"" & msgURL & "\",\"msgTitle\":\"" & msgTitle & "\"}"
else
activate
display alert "Selection" message "Please select a single Mail message." buttons {"OK"}
error number -128
end if
end tell