Less Labor On Labor Day!

Hi all,

David Sparks recent great webinar about Automating Apple Mail was great. One of my favorite parts was how David has been using Apple Mail “message id” to create links to put in other programs.

So from his very cool AppleScript - I made a few updates for my own personal use and am loving how this all works.

For my version, when the AppleScript triggers it will paste 3 lines into the clipboard like:

Message from: [xxxemailxxx]
Subject: [xxxSubjectxxx]
Message URL: message://%[xxxreal message-idxxx]%3e

This text can be pasted wherever you like into whatever program like Filemaker - DevonTHINK - Obsidian - Apple Notes - Reminders etc…

I’m sure I will get a ton of use out of this new functionality.

Here is the simple AppleScript code with these slight mods that came from David Sparks original idea.

	-- From David Sparks - Automating Apple Mail webinar
	set selMessages to selection
	if (count selMessages) > 0 then
		set thisMsg to item 1 of selMessages
		set thisMsgURL to "message://%3c" & (message id of thisMsg) & "%3e"
		tell me to set the clipboard to "Message from: " & sender of thisMsg & return & "Subject: " & subject of thisMsg & return & "Message URL: " & thisMsgURL
		display notification "Message from" & sender of thisMsg & ", subject: " & subject of thisMsg with title "Message Copied"
	else
		display notification "Nothing Selected"
	end if
end tell

Just for fun - a tiny modification…

tell application id "com.apple.mail"
	set selMessages to selection
	if (count selMessages) > 0 then
		set thisMsg to item 1 of selMessages
		set thisMsgURL to "message://%3c" & (message id of thisMsg) & "%3e"
		tell me to set the clipboard to "Message from: " & sender of thisMsg & return & "Subject: " & subject of thisMsg & return & "Message URL: " & thisMsgURL
		display notification "Message from" & sender of thisMsg & ", subject: " & subject of thisMsg with title "Message Copied"
	else
		display notification "Nothing Selected"
	end if
end tell

-- Quickly create a plain text file in DEVONthink from the clipboard
tell application id "DNtp"
	paste clipboard to (display group selector)
end tell

:smiley:

Nice addition.

In my case, I do the same basic idea however I use a Filemaker File to paste this into.
I love this functionality!

Very nice!

Sheesh! I haven’t run Filemaker in over a decade now.
/wanders off to look at the Filemaker site
:stuck_out_tongue:

Thanks for sharing!

I’m doing something similar using Hook and Keyboard Maestro, sending the result to OmniFocus.

How are you triggering your AppleScript?

Hi ebarstad - In my case I’m just using a hotkey in KM to trigger this.

do you know where I can find a recording of the webinar you mentioned? would love to check it out

I think @MacSparky only sends out recording links by registered e-mail just after the webinar, and they may be time-limited. See info here: