Text File to OmniFocus

Description

Originally posted here (and subsequently refined in the comment section of David Sparks's MacSparky Site), this AppleScript was created by Josh Betz to work with Gina Trapani's Todo.txt project -- but it will work with any text file where you're separating tasks on individual lines.

The script lets you select any text file (my addition) to process, adding each line of text as an Inbox task to OmniFocus. The script then eliminates the original items from the text file.

Instructions and more detail about how Josh uses this script can be found on his website.

The Code

(*
http://veritrope.com
Text File to OmniFocus
Version 1.0
May 2, 2011
Project Status, Latest Updates, and Comments Collected at:
http://veritrope.com/code/text-file-to-omnifocus

// MIRRORED FROM JOSH BETZ'S SITE:
http://joshbetz.com/2011/04/todo-txt-to-omnifocus/
*)


(*
======================================
// MAIN PROGRAM
======================================
*)


set p to choose file with prompt "Please Select Your Text File"
set l to paragraphs of (do shell script "grep . " & p)
do shell script ">" & p

tell app "OmniFocus" to tell document 1
repeat with v in l
make new inbox task with properties {name:v}
end repeat
end tell