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: