Return to Snippet

Revision: 28265
at July 6, 2010 03:17 by pdxmph


Initial Code
require "rubygems"
require "appscript"
include Appscript

@things = app("Things")
@todos = @things.to_dos


def create_to_do(name,source,link)
  unless @todos[its.name.eq(name)].get.length > 0
    puts "Didn't find a thing named #{name}. Creating a task."
    if link == ""
      note = name
    else 
      note = "[url=#{link}]#{name} - #{source}[/url]"
    end
    
    task = @things.make(:at => app.lists["Today"].beginning, :new => :to_do, :with_properties => {
      :name => name,
      :tag_names => "panopticon,#{source}",
      :notes => note,
      :due_date => Time.now + 8.hours
    })
  end
end

Initial URL


Initial Description


Initial Title
Create a Todo in Things

Initial Tags
ruby

Initial Language
Ruby