The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniFocus Extras (http://forums.omnigroup.com/forumdisplay.php?f=44)
-   -   make OF action out of current emacs buffer (http://forums.omnigroup.com/showthread.php?t=8398)

jklymak 2008-07-04 01:36 PM

make OF action out of current emacs buffer
 
OK, Thanks to Curt and some of the code on this board, I hacked together a quick emacs script to note the current emacs buffer and make a new action. Comments welcome. No doubt my elisp is horrible...

[code]
(defun sendOmni ()
(interactive)
(let ((fname (buffer-file-name (current-buffer))))
(do-applescript (concat "tell front document of application \"OmniFocus\"
set aTask to (make new inbox task with properties {name:\"From Emacs "
(buffer-name (current-buffer)) "\", note:\"file:///" fname " \" })
tell note of aTask
make new file attachment with properties {file name:\"" fname "\"}
end tell
end tell"))
))
;; I use F3 for omnifocus clipping...
(global-set-key [f3] 'sendOmni)

[/code]

curt.clifton 2008-07-05 01:22 PM

Nice work. Fun to see some eLisp on the forum!

jklymak 2008-07-05 04:47 PM

Thanks Curt. Though I have to say the experience of mashing together these two languages, perverse in such diametrically opposite ways, has been exhausting!

tprouty 2009-08-16 12:11 PM

Thanks jklymak
 
I found your example a really useful jumping off point. I wanted to do something a bit different, which was be able to select a region in emacs and have it pop up in the OmniFocus Quick Entry window to add a new task. More details about why I wanted to do that can be found here: [url]http://timprouty-tech.blogspot.com/2009/08/omnifocus-quick-entry-from-emacs.html[/url]

Here's the code:
[CODE]
(defun omniQuickEntry (beg end)
(interactive "r")
(do-applescript (concat
"tell front document of application \"OmniFocus\"
tell quick entry
make new inbox task with properties {name:\""
(buffer-substring beg end) "\"}
activate
select {inbox task 1}
end tell
end tell")
))

(global-set-key "\C-c\C-o" 'omniQuickEntry)
[/CODE]


All times are GMT -8. The time now is 06:35 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.