Create a Todo in Things


/ Published in: Ruby
Save to your folder(s)



Copy this code and paste it in your HTML
  1. require "rubygems"
  2. require "appscript"
  3. include Appscript
  4.  
  5. @things = app("Things")
  6. @todos = @things.to_dos
  7.  
  8.  
  9. def create_to_do(name,source,link)
  10. unless @todos[its.name.eq(name)].get.length > 0
  11. puts "Didn't find a thing named #{name}. Creating a task."
  12. if link == ""
  13. note = name
  14. else
  15. note = "[url=#{link}]#{name} - #{source}[/url]"
  16. end
  17.  
  18. task = @things.make(:at => app.lists["Today"].beginning, :new => :to_do, :with_properties => {
  19. :name => name,
  20. :tag_names => "panopticon,#{source}",
  21. :notes => note,
  22. :due_date => Time.now + 8.hours
  23. })
  24. end
  25. end

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.