The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniFocus > OmniFocus 1 for Mac
FAQ Members List Calendar Search Today's Posts Mark Forums Read

iCal Publishing and Due Dates > 2 Weeks Away Thread Tools Search this Thread Display Modes

I have a quick question: Is there a way to enable OF to publish due reminders in iCal that are more than 2 weeks away?

I have a few due dates for tasks in 3 or 4 weeks, and it would be nice to see them at a glance in iCal as 'prompts' that I need to pay attention to these.

It would be nice if there was the ability to specify how far away you want due reminders to be before they are published.

In my case, I would prefer ALL due dates to be published in my OF calendar.

I like how OF takes care of the 'fuzzy' stuff, but I like the thought of having all my 'hard' dates in iCal. E.g. meetings must occur on a certain day and time, and so too do particular tasks with due dates. Having only tasks due in the next 2 week show up in iCal seems kind of arbitrary, and is a bit frustrating.

Also, it would be good if tasks with a start and an end date could be put in iCal as multi-day events spanning days from start to end dates. Or at least having this as an option.

But my main gripe is the "due dates must be within 2 weeks to be published in iCal" issue. Why not have ALL due dates published in the calendar? :(

Any suggestions/tips?



Is there anyone that can help me with this? :(
You're using a feature in a way that wasn't intended. The publishing of due dates to the OmniFocus Reminders calendar was a stopgap to get reliable notifications of impending due dates on iOS gadgets which couldn't be counted upon to have internet connectivity at the time of the notification. They are only published two weeks out to keep the amount of work done each time the app syncs reasonable; two weeks should be plenty to allow most people to have a sync opportunity (to get the notification data on their device) between the time the action with a due date is entered in OmniFocus and when it is due.

That said, I can see how one might want to be able to view a calendar with one's due dates, and even started drafting an Applescript to do that, but life has intervened, and I don't know when I'll get back to that little project. You might search the OmniFocus Extras forum and see if there is something there that helps you do what you want.
Just wanted to chime in that I would love to see this as a possibility as well.... I know that calendar syncing has been much discussed in these forums. For me, the "publish due reminders as calendar" might be sufficient for my needs, if only it would publish everything, and not only the items that are 2 weeks or less out.

As a user of OF for probably over 2 years, and an owner of every product (iphone, ipad, desktop), this is the one sticking point for me that I would really love to see addressed.
There's a sample "Publish to iCal" script which runs through all your contexts and creates a new calendar for each one (named "OF: [Context]"), adding any available tasks from that context to that calendar.

The script ships with every copy of OmniFocus: you can find it by Control-Clicking on the OmniFocus app in the Finder, choosing "Show Package Contents" from the contextual menu and navigating into Contents/Resources/SampleScripts.

It wouldn't be difficult to modify the sample script to publish all the tasks into a single calendar instead, or into a specific calendar (such as your default iCloud calendar)—or to create events in iCal rather than "to do"s.

Hope this helps!
Originally Posted by Ken Case View Post
There's a sample "Publish to iCal" script which runs through all your contexts and creates a new calendar for each one (named "OF: [Context]"), adding any available tasks from that context to that calendar.
It's a great script, except for two minor annoyances — it omits nested contexts, and it crashes when you run it, unless you happen to already have calendars named OF: <context> for all of your contexts :-)

A somewhat improved script is provided below. There's an property up top you can edit to control whether the script exports available or remaining actions. It traverses into nested contexts. It does not print the full project name for a project nested in a folder; that will be a fine learning exercise for someone who needs it. No attempt is made to make the calendar events show the amount of time required for various due items, because I don't believe that is useful in most cases. If you feel otherwise, you know where the sources are, knock yourself out :-)

	Copyright 2007 The Omni Group.  All rights reserved.
	$Header: svn+ssh:// 93889 2007-11-02 18:06:50Z bungi $

property pExportAvailableTasksOnly : false -- if false, export remaining tasks; if true, export available tasks

global currentTargetCalendar

tell first document of application "OmniFocus"
	repeat with aContext in flattened contexts
		set MyContextID to (id of aContext)
		set MyContext to context id MyContextID
		CreateContextCalendar of me from MyContext -- also deletes existing calendar
		if ((count of (my GetTasks(MyContext))) > 0) then
			PublishContext of me from MyContext
		end if
	end repeat
end tell

tell application "iCal" to activate

on GetTasks(SomeContext)
	using terms from application "OmniFocus"
		if (pExportAvailableTasksOnly is true) then
			return tasks of SomeContext where blocked is false
			return tasks of SomeContext where completed is false
		end if
	end using terms from
end GetTasks

on CreateContextCalendar from SomeContext
	tell application "iCal"
		set CalendarName to "OF: " & my FullContextName(SomeContext)
			delete (first calendar whose name is CalendarName)
		end try
		using terms from application "OmniFocus"
			set ContextTasks to my GetTasks(SomeContext)
		end using terms from
		set currentTargetCalendar to make calendar with properties {name:CalendarName}
	end tell
end CreateContextCalendar

on PublishContext from SomeContext
	using terms from application "OmniFocus"
		PublishContextTasks of me from SomeContext
		repeat with childContext in contexts of SomeContext
			PublishContext of me from childContext
		end repeat
	end using terms from
end PublishContext

on PublishContextTasks from SomeContext
	using terms from application "OmniFocus"
		set MyTasks to my GetTasks(SomeContext)
		repeat with aTask in MyTasks
			set taskName to name of aTask
			set taskProject to containing project of aTask
			set completionDate to completion date of aTask
			set dueDate to due date of aTask
			if (dueDate is not missing value) then
				set dueDate1 to dueDate + 60 -- if we make zero-length appointments, iCal puts them on top of each other.  Make them a minute long and it spreads them out a bit.
			end if
			local MyEvent
			using terms from application "iCal"
				tell currentTargetCalendar
					if completionDate is equal to missing value and dueDate is not missing value then
						if taskProject is not equal to missing value then
							set MyEvent to make new event at end of events with properties {summary:my FullContextName(SomeContext) & ": " & taskName & " [" & name of taskProject & "]", start date:dueDate, end date:dueDate1}
							set MyEvent to make new event at end of events with properties {summary:my FullContextName(SomeContext) & ": " & taskName & " [Inbox]", start date:dueDate, end date:dueDate1}
						end if
					end if
				end tell
			end using terms from
		end repeat
	end using terms from
end PublishContextTasks

-- return full name of context, or "(None)"
-- uses ":" as hierarchy separator, as OmniFocus does not appear to expose 
-- the value conveniently
on FullContextName(SomeContext)
	using terms from application "OmniFocus"
		local oContext
		local strContextName
		set strContextName to ""
		set oContext to SomeContext
		if (oContext is missing value) then
			return "(None)" -- easy case!
		end if
		-- if there is a context set, we need to construct the full name, 
		-- climbing up the tree to the top.  We take the name of our starting
		-- point, then look at the container.  Each time the container is not
		-- of class document, there's another layer, and we tack its name on
		-- to the front of the string.  
		set strContextName to name of oContext
		repeat while (class of (container of oContext) is not document)
			set strContextName to ":" & strContextName
			set oContext to container of oContext
			set strContextName to name of oContext & strContextName
		end repeat
		return strContextName
	end using terms from
end FullContextName

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
Thread Thread Starter Forum Replies Last Post
iCal export: Show tasks beyond two weeks Commifreak OmniFocus 1 for Mac 0 2013-04-27 04:33 AM
Generic weeks vs. specific dates EmmaA OmniPlan General 2 2012-02-17 04:46 AM
iCal Event in Sneaky Peak 1.8, only 2 weeks out? samoconnor iCal Sync 9 2010-05-06 07:06 AM
iCal syncing with due dates? Taylorgus iCal Sync 1 2008-08-14 03:22 PM
Ability to show time in "in three weeks, in two weeks, tomorrow" formats mr_projects OmniPlan General 1 2007-11-02 11:28 AM

All times are GMT -8. The time now is 09:46 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.