Someone was kind enough to put this script on git to send a selection from 
BBEdit to OmniFocus.  The script works fine if I run it from Apple Script 
Editor, but if I run it from BBEdit I get the following error message.

A scripting error has occurred: <script> doesn't understand the makeOfTask 
message.  Complete noob here so any advice is greatly appreciated.

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

-- 
-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
<http://groups.google.com/group/bbedit?hl=en>
If you have a feature request or would like to report a problem, 
please email "[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>



Reply via email to