🕷 zenspider.com

by ryan davis



sitemap
Looking for the Ruby Quickref?

Removing duplicates from OmniFocus

Published 2008-03-14 @ 10:37

Tagged toys

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