Class: Pullbox::DEVONthink

Inherits:
Object
  • Object
show all
Defined in:
lib/pullbox/devonthink.rb

Overview

DEVONthink AppleScript methods

Class Method Summary collapse

Class Method Details

.open(uuid) ⇒ Object



33
34
35
# File 'lib/pullbox/devonthink.rb', line 33

def self.open(uuid)
  system "open '#{path_to_record(uuid)}'"
end

.path_to_record(uuid) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/pullbox/devonthink.rb', line 9

def self.path_to_record(uuid)
  applescript = "    \#{AppleScript.intro}\n    tell application id \"DNtp\"\n      set theRecord to get record with uuid \"\#{uuid}\"\n      if (type of theRecord as string) is not in {\"group\", \"smart group\", \"tag\"} then return (path of theRecord as string)\n    end tell\n  APS\n\n  `osascript -e '\#{applescript}'`.strip\nend\n".strip

.save_to_record(uuid, string) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/pullbox/devonthink.rb', line 21

def self.save_to_record(uuid, string)
  applescript = "    \#{AppleScript.intro}\n    tell application id \"DNtp\"\n      set theRecord to get record with uuid \"\#{uuid}\"\n      set plain text of theRecord to \"\#{string}\"\n    end tell\n  APS\n\n  system \"osascript -e '\#{applescript}'\"\nend\n".strip