Skip to content

Instantly share code, notes, and snippets.

@derickfay
Created July 29, 2021 06:49
Show Gist options
  • Save derickfay/8ee52862be556f5e3eb9c759514f26b2 to your computer and use it in GitHub Desktop.
Save derickfay/8ee52862be556f5e3eb9c759514f26b2 to your computer and use it in GitHub Desktop.
tell application "DEVONthink 3"
set theBases to databases
set theList to {}
set myitems12345 to {}
repeat with b in theBases
tell b
set theRecs to (every record whose type is group) & (every record whose type is smart group)
repeat with r in theRecs
set title to {title:name of r}
set arg to {arg:reference URL of r}
set subtitle to {subtitle:name of database of r}
set uid to {uid:uuid of r}
if type of r is group then
set p to {path12345:"dtg.png"}
else
set p to {path12345:"dtsg.png"}
end if
set icon to {icon:p}
set theList to theList & {title & arg & subtitle & uid & icon}
end repeat
end tell
end repeat
end tell
tell application "JSON Helper" to set v to make JSON from {myitems12345:theList}
return do shell script "echo '" & v & "' | sed 's/myitems12345/items/g' | sed 's/path12345/path/g'"
@derickfay
Copy link
Author

this version doesn't capture subgroups @status(2021-07-28)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment