Removing duplicates from OmniFocus

| | Comments (0)

Sometimes something (I suspect iSync) screws up and duplicates my tasks. This has proven useful:

tell application "OmniFocus"
  tell first document
    repeat with aContext in contexts
      set toDelete to {}
      set seen to {}
      repeat with aTask in tasks of aContext
        if seen contains name of aTask then
          set end of toDelete to id of aTask
        else
          set end of seen to name of aTask
        end if
      end repeat

      repeat with aTask in toDelete
        try
          delete (task id aTask)
        end try
      end repeat
      count of toDelete
    end repeat
  end tell
end tell

Leave a comment

About this Entry

This page contains a single entry by zenspider published on March 14, 2008 10:37 AM.

rubyforge version 0.4.5 has been released! was the previous entry in this blog.

ZenTest version 3.9.2 has been released! is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Pages

Powered by Movable Type 4.32-en