Drafts Bookmarks and File ActionsEvan Travers
I've been a little behind on Drafts releases… but I finally started reading about the new Bookmarks feature.
Some of my most used Actions just make plaintext files… especially these days with the Mac version. I decided to give some of my classic Actions a revamp with the new features.
The new Bookmarks feature allows you to make a shortcut name for a folder you often access. You can set the same bookmark to be different locations on different devices.
At first I thought I'd have to continue to use Callback URLs on iOS but I underestimated Bookmarks. Both my most used actions have settled into a simple pattern: use a Script Action to transform the Draft, make, decisions, and set variables to be used by a File Action pointed at a Bookmark that's different on each device. Super simple.
Before I had a single complex Script action with a conditional for whether the script was running on Mac or iOS. If iOS, it constructed and opened a URL scheme to Working Copy. On Mac I scripted up a messy shell script that
echod the file to the right location.
Using the new File Action in conjunction with the Bookmarks made this so much simpler.
The Script step is now only responsible for transforming the Draft into the style of markdown my blog consumes and setting up Drafts variables for the filename and file content. The File Action places the file in the right place. Done.
I also simplified my Obsidian Action. I had written a very complex set of actions that set up book notes, linked to those notes, and relied on some of the state staying in Drafts and some in Obsidian. I'm not doing that anymore. 🤷 My workflow is more straightforward: I make a zettel, send to Obsidian, and work on it there. All the Obsidian related automation is moving into Obsidian.
Just like Blog Action there's a Script Action that translates the Draft object into a Simple Markdown Zettelkasten file and sets up variables. Because I use iCloud to sync Obsidian the same File Action can work on both Mac and iOS.
The File Action is a blessing. Before the File Action I had been using a Callback URL to send the data to Obsidian… and it was extremely buggy. Obsidian's long load times sometimes causes it to forget the reason I asked it to load in the first place. Very frustrating. Now it works instantly and every time. If you want to use a Obsidian command or any part of Obsidian Advanced URLs to place the file you still need to use a Callback URL but for simple file creation the File Action is very clean.
In the future I need to refactor Blog and Obsidian to use the same YAML API shared action… they have two separate but nearly identical implementations of Drafts -> Markdown+YAML.
I've very happy with Greg's updates to my favorite application. I know it's impossible… but I wish it worked on other platforms. It's a large part of what's tying me to Apple's ecosystem.