Skip to content

Instantly share code, notes, and snippets.

@gfontenot
Created October 12, 2011 16:38
Show Gist options
  • Save gfontenot/1281756 to your computer and use it in GitHub Desktop.
Save gfontenot/1281756 to your computer and use it in GitHub Desktop.
Send selected lines in BBEdit to OmniFocus
tell application "BBEdit"
set _sel to the selection
set _lines to lines in selection
set tasks_added to {}
repeat with _line in _lines
if length of _line is not 0 then
my makeOFTask(_line as text)
set end of tasks_added to _line as text
end if
end repeat
my growlNotify(tasks_added)
end tell
on makeOFTask(_text)
tell application "OmniFocus"
tell default document
parse tasks with transport text _text
end tell
end tell
end makeOFTask
on growlNotify(tasks_added)
set _count to length of tasks_added
set AppleScript's text item delimiters to return
set tasks_added to tasks_added as text
set AppleScript's text item delimiters to ""
tell application "System Events"
set growl_running to (count of (every process whose name is "Growl")) > 0
end tell
set subj to (_count as text) & " Tasks Added"
set msg to tasks_added
if growl_running then
tell application "Growl"
set the allNotificationsList to {"Tasks Added"}
register as application "OF-BBEdit" all notifications allNotificationsList default notifications allNotificationsList icon of application "OmniFocus"
notify with name "Tasks Added" title subj description msg application name "OF-BBEdit"
end tell
end if
end growlNotify
@jasonb5232
Copy link

Wondering if you have used this with BBEdit 10. The script works great if I run it from the Editor, but I get an error message if I try and run it from BBEdit. "The <script> doesn't understand the makeOfTask message" Complete Noob so sorry if it's a dumb question.

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