Last active
April 30, 2022 11:09
-
-
Save poritsky/4271689 to your computer and use it in GitHub Desktop.
Launch OmniFocus. Create a project called "Recipes". Go to any recipe site in Safari. Run the script.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "Safari" to set recipetitle to name of front document | |
tell application "Safari" to set recipeurl to URL of front document | |
set ingredients to (do shell script "curl http://recipedistiller.com/recipe/classify/?recipeurl=" & recipeurl & " | textutil -convert txt -stdin -stdout | grep '.' | sed 's/ • DELETE //g' | sed '$d'") | |
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 | |
set i to quoted form of ingredients | |
set clean to do shell script "echo " & i & "| grep '.'" | |
set l to paragraphs of clean | |
tell application "OmniFocus" to tell document 1 | |
set theproject to (first flattened project where its name = "Recipes") | |
tell theproject to make new task with properties {name:"Recipe: " & recipetitle, note:"From: <" & recipeurl & ">"} | |
repeat with v in l | |
set theproject to (first flattened task where its name = "Recipe: " & recipetitle) | |
tell theproject to make new task with properties {name:v} | |
end repeat | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated March 24, 2013, adds ability to pull recipe name with ingredients as an indented task group. Also deletes last blank task (but not first) when pulling in ingredient lists.