Deep thought 💭 on Ingredient list to Omnifocus

Sven Fechner posted a link to Jonathan Poritsky’s gist of converting a recipe to discrete Omnifocus actions for each ingredient. I didn’t have luck with the way that it was posted, I kept getting • DELETE in front of each ingredient, so I modified it a little, first to delete the extra text, but also, to create a project for each recipe instead of a large “Recipe” project.

tell application "Safari" to set recipeurl to URL of front document
tell application "Safari" to set recipetitle to name of front document
set ingredients to (do shell script "curl [recipedistiller.com/recipe/cl...](http://recipedistiller.com/recipe/classify/?recipeurl=)" & recipeurl & " | textutil -convert txt -stdin -stdout | grep '.'")
set my text item delimiters to "VIEW RECIPE"
set ingredients to text item 2 of ingredients
set my text item delimiters to "©"
set ingredients to text item 1 of ingredients
-- http://www.macosxautomation.com/applescript/sbrt/sbrt-06.html
set trim_text to tab & "•" & tab & "DELETE "
set new_ingredients to replace_chars(ingredients, trim_text, "")
set l to paragraphs of new_ingredients
tell application "OmniFocus" to tell document 1
set theproject to (first flattened folder where its name = "Recipes")
tell theproject to make new project with properties {name:recipetitle, note:recipeurl}
repeat with v in l
set theproject to (first flattened project where its name = recipetitle)
tell theproject to make new task with properties {name:v}
end repeat
end tell
on replace_chars(this_text, search_string, replacement_string)
set AppleScript's text item delimiters to the search_string
set the item_list to every text item of this_text
set AppleScript's text item delimiters to the replacement_string
set this_text to the item_list as string
set AppleScript's text item delimiters to ""
return this_text
end replace_chars
Published: Dec 16, 2012 @jeredb →