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 = <<~APS.strip
    #{AppleScript.intro}
    tell application id "DNtp"
      set theRecord to get record with uuid "#{uuid}"
      if (type of theRecord as string) is not in {"group", "smart group", "tag"} then return (path of theRecord as string)
    end tell
  APS

  `osascript -e '#{applescript}'`.strip
end

.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 = <<~APS.strip
    #{AppleScript.intro}
    tell application id "DNtp"
      set theRecord to get record with uuid "#{uuid}"
      set plain text of theRecord to "#{string}"
    end tell
  APS

  system "osascript -e '#{applescript}'"
end