Working with linked files and images in Drafts (actions and workflows)

I threw something together in response to a query about Drafts file references in another forum, and figured it might be useful to share here. When it comes to working with references to other files/images, the workflows I’ve come across thus far include:

  • A Drafts action to select a file from a single bookmarked folder…
  • A shortcut to select a file (allows traversal of folders and sub-folders) then return to Drafts with the appropriate reference/link (this could obvs be invoked by a Drafts action for an easier flow)…
  • Shortcuts to capture/select images to/from Photos or Dropbox and paste the resulting reference/link in Drafts…

Collecting a few workflows and actions

First, the action I made. It allows you to select a file from a bookmarked folder and insert a link to that file in the current draft. I made this with i(Pad)OS in mind; I’m assuming it’ll carry over for macOS, but wouldn’t be surprised if something needs tweaking.

In addition, anyone who finds the above action useful might also be interested in solutions for linking to images. Spotlighting this one by @Sorashima (via iCloud):

…this post from @jarno527 that references a shortcut for referencing images in Dropbox:

…and finally, this (more involved) post from @sylumer for including templates, other drafts and images within a drafts preview:

If there’s anything obvious I’ve missed, please add on.

9 Likes

Thanks again for your help in that other forum. I think these tips will be very useful for everybody that wants to use Drafts for note taking and doesn’t need a fullblown multimedia app like OneNote but wants an image or file with his notes from time to time.

The exploded preview thing makes my head explode, but I’m happy with the simpler stuff.

1 Like

Update: fixed a breaking error in the first action here. Doh! Download and (re)install from the same link above. File URLs once again correctly include Files.app URL scheme prefix (“shareddocuments://”). If you’ve installed it already and it’s not working as you expected, this is probably why. Thanks to @yashodhankhare for picking that up.

I’ve also made Markdown style links the default in this update, but if you’re using any of the built-in Markdown syntax definitions, you can enable [[url:…]] style links with a simple (and signposted) adjustment in the script.

Finally: as I’ve said somewhere in the notes, I made this action with i(Pad)OS in mind. It’d be cool to make it cross-platform (instead of “shareddocuments://”, macOS would need “files://”) but that would take a bit more doing— as outlined in this thread. I think the use of a wiki-link defined within a syntax is probably the easiest way to go, but that would require people to install another action to make it work…

I’m toying with the idea of rolling something like this into the Markdown (GitHub) + Wiki-Link Extras syntax then bundling a few actions together as a supporting action group…

2 Likes

Definitely going to be tweaking this action to support my custom syntax. Thanks for sharing this! It’s great. Curious if you’ve looked into supporting nested folders within the file selection.

Glad to hear it’s something you find useful!

Nested folders: thought about it for a moment, but didn’t go as far as looking into what it might require. I’m not sure it’s even possible with the way Drafts’ file/folder bookmarks work (waits for someone to corroborate or correct…:roll_eyes:)?!

Hi,

Having downloaded the action for inserting links to the images, I am getting an error and I am not at all sure what I am doing wrong. I appear to have a folder in the right location and images stored in that folder, but the error message I am getting appears to indicate that I have no folder with images.

Here are some screen shots to illustrate what I am talking about.

Screenshot_18_08_2023__09_19

As you can see from the file directory, I appear to have the correctly named folders in the correct place, but yet I am still getting the same error message (above)

Images

What’s going on here!? What am I doing wrong?

1 Like

Looks like you have put things in Images, but the message references images. Try changing that and see if it resolves it.

1 Like

Smashing. That worked a treat. Thanks for your help.