Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env ruby
- #gem install rb-scpt (ruby < 2.5.0)
- require 'rb-scpt'
- APP = Appscript.app("Things3.app")
- def inbox
- APP.lists.get.detect{|l| l.name.get == 'Inbox'}
- end
- def todos
- inbox.to_dos.get
- end
- def todo_texts
- todos.map do |todo|
- [todo.name.get + todo.notes.get]
- end.flatten
- end
- def file_text
- todo_texts.select do |text|
- text.strip != ""
- end.join("\n")
- end
- def filepath
- ENV['HOME'] + "/Desktop/inbox.txt"
- end
- def write_to_file
- open(filepath, 'a') { |f|
- f.puts file_text
- }
- end
- write_to_file
Add Comment
Please, Sign In to add comment