Pages

Monday, November 13

Moving from Omnifocus to Reminders

Let's say you're like me, an avid Omnifocus user, but you've been hearing great things about Reminders on MacOS/iOS/iPadOS, and you want to give it a shot.  Well, here's an AppleScript that will move everything over for you. It won't delete anything out of Omnifocus, so nothing will get messed up, but, it will take your existing projects and move them over as separate lists, then move the tasks over, preserving flagged, priorities, and the notes in each task (to Reminders.app's limitations).

TWO CAVEATS THOUGH

1. It can't move nested (subtasks) tasks from Omnifocus over, this is a very tricky problem to solve, and it's beyond my AppleScripting skills to access the subtasks and move them over properly.  
2. I wanted to implement "tags" from Omnifocus over to the "tags" feature in Reminders, however Apple doesn't have "tags" as a Reminders dictionary item in AppleScript.

Other than that, this works fine:

property defaultList : "Inbox"


tell application "OmniFocus"

activate

tell front document of application "OmniFocus"

set theProjects to flattened projects -- Gets all projects, ignoring folders

repeat with aProject in theProjects

set projectName to name of aProject

set projectStatus to completed of aProject

-- Process only if the project is not completed

if not projectStatus then

set theTasks to tasks of aProject

-- Create a list in Reminders for each non-completed project

my createListInReminders(projectName)

repeat with aTask in theTasks

set taskStatus to completed of aTask

-- Process only if the task is not completed

if not taskStatus then

set theTaskName to name of aTask

set theNote to note of aTask

set theDueDate to due date of aTask

set isFlagged to flagged of aTask -- Check if the task is flagged

-- Determine priority based on flagged status

set thePriority to 0 -- default no priority

if isFlagged then

set thePriority to 1 -- high priority for flagged tasks

end if

-- Add tasks to the corresponding list in Reminders

my createReminder(projectName, theTaskName, theDueDate, theNote, thePriority)

end if

end repeat

end if

end repeat

end tell

end tell


on createListInReminders(listName)

tell application "Reminders"

if not (exists (list listName)) then

make new list with properties {name:listName}

end if

end tell

end createListInReminders


on createReminder(thelist, theTask, theDate, theNote, thePriority)

try

set theBody to theNote

tell application "Reminders"

if not (exists (list thelist)) then

my createListInReminders(thelist)

end if

tell list thelist of default account

if theDate is not missing value then

make new reminder with properties {name:theTask, remind me date:theDate, body:theBody, priority:thePriority}

else

make new reminder with properties {name:theTask, body:theBody, priority:thePriority}

end if

end tell

end tell

on error

-- Error handling can be implemented here if needed

end try

end createReminder





Please leave comments below.