I found an almost perfect script to add my Omnifocus tasks with Due dates to a calendar. The only issue with the script is that if a due date does not have a time set, it is putting the calendar entry to 12am which is very out-of-site-out-of-mind. Is there any way to change this script so that un-timed tasks are set to either all-day events, or at least to early morning like 7 or 8am? Searching the Omnifocus applescript dictionary I can see no reference to due time. The script is by Rosemary Orchard:
property calendar_name : “OmniFocus” – This is the name of your calendar
property default_duration : 30 --minutes– Rosemary Orchard
– Modified from a script by unlocked2412
– This creates calendar events for tasks which have a due date, if an estimated time is not set then the task defaults to 30 minutes in lengthtell application “Calendar”
set calendar_element to calendar calendar_name
tell calendar calendar_name
set theEvents to every event
repeat with current_event in theEvents
delete current_event
end repeat
end tell
end telltell application “OmniFocus”
tell default document
set task_elements to flattened tasks whose ¬
(completed is false) and (due date ≠ missing value)
repeat with item_ref in task_elements
– GET OMNIFOCUS TASKS
set the_task to contents of item_ref
set task_name to name of the_task
set task_note to note of the_task
set task_due to due date of the_task
set task_estimate to estimated minutes of the_task
set task_url to “omnifocus:///task/” & id of the_task
if task_estimate is missing value then set task_estimate to default_duration
– BUILD CALENDAR DATE
set start_date to task_due
set end_date to start_date + (task_estimate * minutes)
– CREATE CALENDAR EVENT
tell application “Calendar”
tell calendar_element
if not (exists (first event whose (start date = start_date) and (summary = task_name))) then
make new event with properties ¬
{summary:task_name, start date:start_date, end date:end_date, url:task_url} at calendar_element
end if
end tell
end tell
end repeat
tell application “System Events”
display dialog “Done”
end tell
end tell
end tell