/ Published in: Ruby
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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