I’m a fairly novice Automator who has a bad habit of trying to bite off more than I can chew. I’m hoping you guys could lend me a hand.
I am a scientist using templates to help me organize my experiments. I have a set of task paper templates I use and heavily customize to send to Omnifocus, relying on Rose’s great Drafts actions. Currently, everything goes into Omnifocus, but some actions really should be duplicated as calendar events so I can keep track of when my busy lab days are.
What I’m envisioning is taking my drafts template, customizing it as I need to, sending everything to Omnifocus, and parsing out events with a certain tag to create calendar events of those tasks.
Can I do this without teaching myself scripting? Drafts? Workflow/shortcuts? Help?
Parsing out anything with a specific tag providing that word is unique would definitely work. Alternatively you could just choose the specific lines you want as calendar events. How would you want them represented in your calendar - as all day events?
A typical example is I have an experiment that starts with 5h task on day 0, has a 4h task on day 3, and two 2h tasks on day 7 that are 4h apart.
If I add durations and start times in the default template, I could always later adjust the calendar event as needed. My template asks for the start date and creates relative due dates based on that day. I can add a specific time for those, can’t I? Something like <> +2d 10a? I have to look up the syntax.
If there’s an estimated time and a due or a deferred time this would be doable - though I’m now thinking that it might be better to send the TaskPaper to OmniFocus and then share the OmniFocus project to Shortcuts/Workflow which means you get the great date parsing in OF (e.g. Thursday -2d), and then the ability to add these to your calendar… I’ll have a play and see what I can do!
The idea is you share a project from OmniFocus to this Workflow, then you choose the tasks you want to make calendar events for, and select if it should create these based on defer or due dates, then it will try to do its magic! It worked in basic testing for me, but it’s quite possible I’ve missed something.
I’ve tried using this awesome shortcut but I can’t get it to work - when I choose the “due” date option it seems to go through, but nothing actually happens, and there are no new calendar events. When I instead choose “defer date” I get the following error message:
“Conversion error: Adjust date failed because Shortcuts couldn’t convert from Text to Date”
Could someone help me with what’s going wrong? I don’t understand the script well enough to know what I should be looking for…
The “defer date” option is the one I want - I basically just want to be alerted by my calendar about things I should be starting (or I might try to build a workflow that will send me an email each day with the events from the omnifocus calendar, so I only get alerted to new tasks as opposed to the ones I already know about).
Note that on the left it uses a date variable, but on the right it is using a due/defer magic variable, which actually references back to a prompt at the start of the shortcut which allows you to choose between “due” and “defer” - both text items that aren’t coercible into dates.
I’d guess that swapping that due/defer variable for the same dates variable in the first screenshot might give better results. BUT,since I don’t have OmniFocus, I can’t confirm this end to end.
Give it a try and see if that sorts things out.
If not I’d fall back to putting in some quick look/show results actions on the date being passed in and on the estimated minutes variable - the two variables that form the date adjustment operation that is failing.
I’ve got a template expander that runs in Scriptable. I prefer to keep my templates in OmniFocus itself. This script accepts projects shared from OmniFocus and puts the expanded templates directly back in omnifocus. I have been using Workflow then Siri Shortcuts for this but the scripts get a bit unwieldy. Scriptable looks much better for more complex tasks.