Summary Emails everyday

A new user of OF2. Quite impressed. Thanks!

The more I end up using the OF2 as THE tool for all my projects and activities, the more I find it necessary to have a summary.

One of the things I like about Asana is how they send such a nice summary email everyday - Tasks you did today, you missed today and how each project progressed today.

Being able to send such a summary email through a shortcut to oneself would be a great add on, I’d have thought to have found already - but can’t figure how to, if it is at all possible.

3 Likes

Not a built-in feature, but probably achievable to AppleScript :D

I actually just posted requesting the same thing. Todoist has a nice daily digest feature also and I find myself missing it. There is a really nice script which creates a well formatted summary of completed tasks and sends them to Evernote. I expect that this could be augmented. I may give it a try but I’m not really the guy for the job.

Some inspiration:

I’m also looking for something similar. Does anyone have resources re a script like this? (Though I have long had ambition to learn scripting, I have not yet done so. Therefore, I’m not looking to build my own solution at this time.)
Thanks!
Lenore

Dragging this up from the history books - has anyone got any idea how to do this? Ideally I’d like an automated email every day with my forecast perspective…(or alternatively a secretary that tells me what to do ;) )

Would this work with something like Zapier or IfTTT?

Hi again,

I found the following script at The Brooks Review ([https://brooksreview.net/2015/07/daily-emails/]), but I can’t seem to get it to work - it sends an email, but the email is empty. This is literally the first time I have opened AppleScript, could anyone with more knowledge have a peek at this to see if there is something simple or obvious to fix? It would be great to be able to send emails with the task list of due today or starting soon (in essence the forecast view).

Many thanks

–==============================
– Script name: Email OmniFocus Task Completion Report
– Version 1.2
– Written By: Phil Gorrindo pgorrindo.github@gorrindo.com and http://phil.gorrindo.com
– Description: This script retrieves a list of OmniFocus tasks completed yesterday or today. It then sends an email report.
– Version History:
– 1.0 - Initial release
– 1.1 - fixed errors on unescaped angle brackets and quotes, and removed context/project title code to speed up script
– 1.2 - added switch for sending email via mail.app or command-line, since command-line doesn’t work with some ISPs
– Based on the following original scripts:
http://www.tuaw.com/2013/04/15/applescripting-omnifocus-send-completed-task-report-to-evernot/
http://veritrope.com/code/write-todays-completed-tasks-in-omnifocus-to-a-text-file/
– Great Many Hacks added by: Ben Brooks (brooksreview.net) to make this an email sent to email address.
–==============================

property toAddress : “YOUR EMAIL ADDRESS”
property fromAddress : “YOUR EMAIL ADDRESS”
–property theReportScope : “Yesterday”
property theReportScope : “Today”

– send the email via Mail.app or via command-line. Command-line won’t always work, if an ISP blocks this
– possible options: “mail.app” | “cli”
property emailMethod : “mail.app”

set theMessage to my do_OmniFocus()

my send_email(theMessage)

on do_OmniFocus()
set theStartDate to current date
set hours of theStartDate to 0
set minutes of theStartDate to 0
set seconds of theStartDate to 0
set theEndDate to theStartDate + (23 * hours) + (59 * minutes) + 59

if theReportScope = "Today" then
	--then do nothing
else if theReportScope = "Yesterday" then
	set theStartDate to theStartDate - 1 * days
	set theEndDate to theEndDate - 1 * days
end if

set theMessage to "<html><head>
<style>
h2 {font-size: 24px;font-family: -apple-system, HelveticaNeue, LucidaGrande;color:#1FB0E0 ;margin-top: 30px;margin-bottom: 0;}
h3, h4 {font-size: 22px;font-family: -apple-system, HelveticaNeue, LucidaGrande;font-weight: normal;margin-bottom: 10px;}
ul {font-family: -apple-system, HelveticaNeue, LucidaGrande;margin: 0;}
li {font-size: 18px;list-style-type: circle;}
hr {border: 2px solid #eee; }
body {width: 90%;margin:auto;font-family: -apple-system, HelveticaNeue, LucidaGrande;}
</style>

Upcoming tasks for " & (date string of theStartDate) & "


"
tell application "OmniFocus"
	activate
	tell default document
		--getting the due tasks
		set refDoneTasks to a reference to (flattened tasks where (due date ≥ theStartDate) and (due date ≤ theEndDate))
		set numberTasks to count of refDoneTasks
		
		set theMessage to theMessage & "<h4>Number of tasks due: " & numberTasks & "</h4><br>"
		set theMessage to theMessage & "<ul>"
		
		set {lstName} to {name} of refDoneTasks
		repeat with iTask from 1 to count of lstName
			set {strName} to {item iTask of lstName}
			set strName to my remove_quotes(strName)
			
			set theMessage to theMessage & "<li>" & strName
			set theMessage to theMessage & "</li><br>"
		end repeat
		set theMessage to theMessage & "</ul><hr>"
		--now we go get the starting tasks
		set refDeferTasks to a reference to (flattened tasks where (defer date ≥ theStartDate) and (defer date ≤ theEndDate))
		set numberDeferTasks to count of refDeferTasks
		
		set theMessage to theMessage & "<h4>Number of tasks starting: " & numberDeferTasks & "</h4><br>"
		set theMessage to theMessage & "<ul>"
		
		set {lstName} to {name} of refDeferTasks
		repeat with iTask from 1 to count of lstName
			set {strName} to {item iTask of lstName}
			set strName to my remove_quotes(strName)
			
			set theMessage to theMessage & "<li>" & strName
			set theMessage to theMessage & "</li><br>"
		end repeat
		set theMessage to theMessage & "</ul>"
	end tell
end tell

set theMessage to theMessage & "</body></html>"

end do_OmniFocus

on send_email(theMessage)
set theTimeStamp to (do shell script “date ‘+%Y-%m-%d’”)
set theSubject to “Your Daily Agenda For (” & theTimeStamp & “)”

if emailMethod is equal to "mail.app" then
	tell application "Mail"
		activate
		set theNewMessage to make new outgoing message with properties {subject:theSubject, visible:false} -- visible MUST be false to work
		tell theNewMessage
			set html content to theMessage -- must set the HTML CONTENT rather than the CONTENT
			make new to recipient at end of to recipients with properties {address:toAddress}
			send
			--set theNewMessage to make new outgoing message with properties {subject:theSubject, html content:theMessage}
			--set sender of theNewMessage to fromAddress
			--tell theNewMessage
			--make new to recipient at end of to recipients with properties {address:toAddress}
			--send
		end tell
	end tell
	
else if emailMethod is equal to "cli" then
	do shell script "echo " & quote & theMessage & quote & " | mail -s \"$(echo \"" & theSubject & "

Content-Type: text/html")" " & toAddress & " -f " & fromAddress
end if
end send_email

on remove_quotes(strName)
set astid to AppleScript’s text item delimiters
set AppleScript’s text item delimiters to quote
set strName to text items of strName
set AppleScript’s text item delimiters to “”
set strName to strName as text
set AppleScript’s text item delimiters to astid
return strName
end remove_quotes

I would love to have this too. Actually, I would love to be able to have statistics of how am I doing to fine tune my planning and worflows (i.e. % of due dates met, average daily nbr of actions completed … and so on.

I guess though this would be a bid new function. Maybe if the history of omnifocus could be downloaded to Access os some database where you can exploit it…