Skip to content

Instantly share code, notes, and snippets.

@travis
Created December 30, 2009 19:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save travis/266317 to your computer and use it in GitHub Desktop.
Save travis/266317 to your computer and use it in GitHub Desktop.
(defun clean-applescript-input (s)
(replace-regexp-in-string
(regexp-quote "\"") "\\\\\""
(replace-regexp-in-string
(regexp-quote "\\") "\\\\\\\\" s)
)
)
(defun omni-quick-entry (beg end)
(interactive "r")
(let ((s (split-string (buffer-substring beg end) "\n")))
(do-applescript (concat
"tell front document of application \"OmniFocus\"
tell quick entry
make new inbox task with properties {name:\"" (clean-applescript-input (first s)) "\","
"note:\"" (clean-applescript-input (mapconcat 'identity (rest s) "\n")) "\"}
open
select {inbox task 1}
end tell
end tell")
)))
;; I use C-s-w for omnifocus clipping...
(global-set-key (quote [C-s-268632087]) (quote omni-quick-entry))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment