Zettelkasten Forum

macOS Automator Quick Action: Sort Selected Lines

A user requested a sorting feature be added to The Archive. I generally prefer to experiment with such functionality in the user-space, aka with scripts, before I bake this into the app.

So I cobbled together an Automator Service (now called "Quick Action") in a minute or two: it takes any selected text from any app, sorts its lines, then replaces the result.

The result is attached to this post. Extract the Zip, then double-click the Quick Action bundle to install it to your global "Services" directory. You can also inspect it by opening it with Automator.app on your Mac.

Once installed, the service is available when you right-click selected text in e.g. The Archive; in the context menu, select ServicesSort Selected Lines, and after a second or so it should have sorted your lines of stuff.

It's not Markdown aware; it just sort text. So please don't re-sort your deeply nested manuscript file and expect it to sort by list indentation. It would put lines starting with whitespace at the top :)

Author at Zettelkasten.de • https://christiantietze.de/


  • Great little quick action. I've been puzzling all day how to adapt this so that it works on rich text without losing any hyperlinks attached to the text. Any ideas how I might do that?

Sign In or Register to comment.