The content of this workflow / scripts is too large to fit in one post - see these posts for the other parts/scripts:
- Additional resources - Automatically capture and annotate items: Markdown Annotation Helper
- Additional resources - Automatically capture and annotate items: DEVONthink helper, Smart rule scripts, JS/Markdown helper
I’ve read several threads on this forum about creating/extracting highlights, backlinking, working together with Obsidian etc. I’ve been developing a system to clip content, automatically capture PDFs (for long-term reference and search), automatically create/update annotations for captured resources, be able to link / use annotations in sync with Obsidian.
What these scripts do
- Automatically capture clipped bookmarks / URLs to PDF
- Automatically create an annotation for all captured content (bookmarks and PDF)
- Automatically link annotation files to captured content
- Update information in DT when update the annotation (.md) file (e.g. changing tags)
- Update information in .md file when updating MD (e.g. changing tags)
- Show links to original files and DT items based on Markdown metadata using JS (see last script)
- Use Keyboard Maestro to open files in Finder (circumventing Obsidian
This is a highly personal setup. I’m providing these scripts and workflows because it might help others (and I’ve been able to build this based on the very helpful posts and comments on this forum myself!). There might be some generic pieces which could be interesting e.g. on processing Markdown files in the Helper scripts below.
I’d be surprised if anyone gets this set up (or even wants to) in the same way I have (as my requirements are probably highly peculiar anyways) I’m probably not able to offer much support so this is mostly if you’re quite familiar with scripting in DEVONthink. It’s all AppleScript so I’m just waiting for @chrillek to write a JXA version of all of this
Why such an elaborate workflow?
My reasoning for this is that the annotation file can hold all “outgoing” information (the original URL, title, capture date, DT links, tags), but at the same time I’m staying ‘independent’ of DT when it might go away, not be available. It also prevents having to save all my captured (PDF) content directly to my Obsidian vault, while still getting all the context (URLs, highlights, notes etc.) - this makes it all more lightweight for daily use. Linking to a ‘resource’ in Obsidian, means linking to the .md file which hold all the relevant context to proceed from or add information to.
When you’ve installed everything in this post (a lot!) you’re able to clip something as a bookmark or a PDF and automatically create / update annotations or items. As an added bonus you can also capture content by clipping it via an imported markdown file (e.g. via MarkDownload. Actually: using MarkDownload to clip content was how I originally started - currently I’m mostly clipping bookmarks or PDFs directly.
An annotation file looks like this (below) and is ‘linked’ via
set annotation. I’m not using the standard Annotation group or naming which DT uses, but I’m putting all annotations in a single annotationsGroup e.g. /Notes/Content, which is a folder in my Obsidian vault (this vault is also indexed in my DT)
--- date: 2022-03-13 22:50 url: https://gist.github.com/itst/780dee5c510db6d1327c34c39166eb0f itemurl: x-devonthink-item://D6C8E1D6-B386-44BC-98DB-6FA7E08F9BDF annotationurl: x-devonthink-item://95CCC418-3AED-4016-A02E-C4FCC7A67B9B path: Resources/fiddle/pkm/read-later/Import and regularly replicate your Pinboard bookmarks in DEVONthink.pdf tags: [fiddle,pkm,read-later,devonthink] --- Excerpt:: Import and regularly replicate your Pinboard bookmarks in DEVONthink. - Pinboard.scpt
To install these scripts:
- Check the other posts and scripts: Additional resources - Automatically capture and annotate items: Markdown Annotation Helper and Additional resources - Automatically capture and annotate items: DEVONthink helper, Smart rule scripts, JS/Markdown helper
- Create a “/Content” group in a database (e.g. Resources) to put all your content in. I’m using Group Tags instead of folders
- All captured content is put in “/Content/00-captured”
- Add a custom metadata item ‘originaltags’ (Single line text) . This is needed to be able keep original tags (added with clipping content) when using Classify
- Download and install [RegexAndStuffLib v1.0.7] to (https://s3.amazonaws.com/latenightsw.com/ShaneLibs/RegexAndStuffLib_stuff.zip) into ~/Library/Script Libraries/ - see RegexAndStuffLib Script Library - AppleScript - Late Night Software Ltd. for more info
- Install Readability.js in /Users/mdbraber/Library/Application Scripts/com.devon-technologies.think3/Smart Rules
- Install the scripts below in the Smart Rules directory (/Users/mdbraber/Library/Application Scripts/com.devon-technologies.think3/Smart Rules)
- Set up the Smart Rules and inline Applescripts - I’m using a Smart Rule on the Inbox and put all captured content in “/Content/00-captured” for further processing (mostly tagging)
Bugs / TODO
- Probably this whole thing is hard to figure out anyway, so I’d be surprised if anyway gets this setup, but maybe there are bits and pieces which are useful for someone
- Comments from clipped content (e.g. a bookmark) are considered an Excerpt in the .md file. I still need to add some regex to be able to also add comments and an excerpt inside the Comments field
- I’ve got some code to automatically extract highlights from PDFs and do the reverse: use text from an annotation file as highlight in PDFs. It’s mostly barebones for now, I might share this at a later stage.
Applescript: Process incoming annotation