Skip to content

Instantly share code, notes, and snippets.

@mfcabrera
Last active December 13, 2015 17:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mfcabrera/4949467 to your computer and use it in GitHub Desktop.
Save mfcabrera/4949467 to your computer and use it in GitHub Desktop.
A script using MacRuby to export all the todos from Things projects into text files (my goal is to "copy and paste" them into 2DO.
#make sure you use macruby
framework "ScriptingBridge" #let's use the scripting bridge framework
# this is aweful - maybe a wrapper would be nice
# you can ge this BundleIdentifier using the mdls
# mdls -name kMDItemCFBundleIdentifier /Applications/Things.app
things = SBApplication.applicationWithBundleIdentifier("com.culturedcode.things")
# lets get the projects that is what I am interested in
# the propertie is called "to dos" but it marshaled as "toDos"
# this is found nowhere in the documentation
#this is the weirdest thing - the property status does not return
# a string as defined in the documentation but a code.
# i had to "reverse engineer" this and I am not sure if it will
# work in all the systems
open_code = 1952737647
things.projects.each { |pr|
File.open("#{pr.name}.txt", 'w') { |f|
pr.toDos.each {|todo| f.puts todo.name if todo.status == open_code }
} if pr.status == open_code
}
#that's all folks! - easy isn't it... :S
@mfcabrera
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment