Create Multiple Items in an Omnifocus Project that Include an Attached Document

I have a pretty specific need (or want). I just can’t figure out how to pull it together. I receives order that will not need to ship for weeks or months. My dream scenario would be to add a document to a folder and have it trigger the creation of several actions in Omnifocus. To complicate matters, the actions would have different dates.
I receive an order from Wayne’s Widget Warehouse. It will not ship until August 1. I want to create five actions in my “Order Processing” project.

  • Enter Order (Probably today, but it is best to be able to select a date.)
  • Pull Order (Another selected date)
  • Ship Order (Still another selected date)
  • Invoice Order (Same as ship date)
  • Receive Payment (either 30 or 60 days after Invoice Date

Because I have dozens of order in the system, each action needs to include the customer name and order number. So, for example, it might say “Enter Order Wayne’s 123ABC” and “Ship Order Wayne’s 123ABC”.

In my perfect scenario, the triggering document would then be attached to each action, so that I have quick access to it each step of the way.

Currently I am able to create the tasks through a shortcut, but I cannot attach the document automatically. Or I can use a template in OF, but not attach the document.

Any suggestions would be appreciated.

As far as the trigger goes, it seems like Hazel or Keyboard Maestro would both be options for this. Obviously Hazel is specifically designed for taking action when files are created, but I think that Keyboard Maestro will more easily be coerced into prompting you for dates, if they can’t be calculated automatically. (Alternatively, you could use a TextExpander snippet or similar to make sure they’re included in the file name in some consistent manner, and have Hazel extract them as tokens for use in your script.)

Both could extract the customer name and order number if the files are in a consistent format, and use these to create the tasks in OmniFocus using a script.

For example, I have a (admittedly hacked-together over the years) AppleScript similar to the below in many Hazel rules. Feel free to steal and adapt it as needed. :slight_smile:

	set Amount to item 1 of inputAttributes
	set due_date to item 2 of inputAttributes
	set task_title to "Pay Bank CC ($" & Amount & ")"
	tell front document
		set theProject to first flattened project where its name = "💳 Finance Administrator ∞"
		tell theProject
			set NewTask to make new task with properties {name:task_title, due date:due_date}
			tell the note of NewTask
				make new file attachment with properties {file name:theFile, embedded:true}
			end tell
		end tell
	end tell
end tell