blob: 417cb6d5649e72b8d85c7b2474e12ce6b5a382f7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
;; DEVONthink interaction
(require 'jao-applescript)
(defconst *jao-devon-sep* "####")
(defun jao-devon-path (dvp)
(car (split-string dvp *jao-devon-sep*)))
(defun jao-devon-url (dvp)
(cadr (split-string dvp *jao-devon-sep*)))
(defun jao-devon-name (dvp)
(car (last (split-string (jao-devon-path dvp) "/"))))
(defun jao-devon-make-dvp (path url) (concat path *jao-devon-sep* name))
(defun jao-devon-dvp-p (dvp)
(and (stringp dvp)
(string-match (concat "^/.+" *jao-devon-sep*) dvp)))
(defconst *jao-devon-sel-as*
(concat "set rs to the selection
set r to item 1 of rs
set rn to the name of r
set rl to the location of r
set ru to the URL of r
rl & rn & \"" *jao-devon-sep* "\" & ru"))
(defun jao-devon-selection ()
(interactive)
(jao-as-tell-app "DEVONThink Pro" *jao-devon-sel-as*))
(defun jao-devon-open-as (path)
(concat "set r to get record at \"" path "\""
"\n open window for record r\n activate"))
(defun jao-devon-open (dvp)
(if (eq system-type 'darwin)
(let ((path (jao-devon-path dvp)))
(when path
(jao-as-tell-app "DEVONThink Pro" (jao-devon-open-as path) t)))
(browse-url (jao-devon-url dvp))))
(provide 'jao-devon)
|