Alfred workflow for The Archive
Hi all,
I am building an Alfred Workflow for The Archive. This workflow will allow you to do many of the things that you would otherwise use Keyboard Maestro to do.
So far I have:
- Create new note with an optional Zettel ID
- Create new note from a template (templates are existing notes that are tagged as such)
- Search and open a note (by title, but with an option to search by content) in The Archive using Alfred
- Search all TODOs in notes and toggle them on/off with Alfred
- Search and open note in the default editor
- Search and copy note as a markdown link
- Search and copy note (or paste directly in front most app) as a wiki link
Anything I am missing?
Howdy, Stranger!
Comments
Wow. That will be very welcome. One thing I recently built for myself was a silly little script to select a note at random and open it in The Archive. I use it for random bits of gardening when I have a short break. But of course, that will still be available to me.
Would you be willing to share the workflow?
Wow! Quite a workflow. I have been using @sai's Alfred workflow, linked to here which includes a search for tags from Alfred launch bar. When the required tag is found it is copied to The Archive (or front most application). I have found that very useful. It also allows the creation of new tags.
It's not quite finished, but hopefully I'll have something to share this coming week. I'm also adding the ability to create a new note from the text in the clipboard, optionally using a template. This way you can copy (or cut) text from an existing note or other source, and paste the text as a new note using a hotkey.
I will see about adding that to it also.
Thank you. I look forward to the finished product.
The workflow does not maintain a TAGS.md file so you cannot create them. However, it searches all existing tags (along with counts) from your notes and you can either paste a tag to the frontmost app, or you can display all notes that use the tag in The Archive.
@ctietze I noticed that
thearchive://match/#mytag
does not work butthearchive://match/mytag
does. It seems likethearchive://
does not support hash symbols in the query. Is this a bug?@Jeremy @DavidWJ @michaelmcdonald @ctietze
v1.0.0 is released. There is no documentation at the moment, but it should be fairly self-explanatory once you have installed the workflow in Alfred.
As you can see, each of the available actions are on the same column in the screenshot above. For example, type
ar
to search your notes,arrandom
to open a random note,arnew
to create a note, etc.I have included empty Hotkeys for each of the actions, you can use these to set your own if desired.
Here is an example template:
The
{content}
tag is where the clipboard content goes if you have selected to paste the clipboard into the new note.There are a few options that you can set, use the
arconfig
keyword to change them. Holding downshift
will open the Help file in Quickview for each option.You won't need to set the path to your notes as the workflow will automatically get the path set in The Archive preferences.
I have also added a File Action to import images into the media folder of The Archive and copy the markdown link to the clipboard so that you can paste it directly into a note.
The workflow uses OneUpdater for updates, so you will need to install that workflow to make use of it.
Hope you all find this workflow useful!
https://github.com/pryley/alfred-the-archive/releases
Screenshots here: https://www.alfredforum.com/topic/15090-alfred-workflow-for-the-archive/
@pryley Thank you. I look forward to trying out (and learning from) this workflow. Thank you as well for the correction regarding new tags.
@pryley Thank you! Could you expand on how to use a template in the workflow? Ideally when creating a new zettel it opens with a some desired structure, and I'm trying to find where to fit that into the workflow.
@johnny
To use a template, create a note in The Archive and tag it somewhere in the first 5 lines of the note with
#template
(you can change the tag used for templates in the workflow config).You may use the following placeholders in your templates:
{title}
This is the title of your note{zettel_id}
This is the Zettel ID of the note (if it exists){tags}
These are the tags (if provided){date}
This is the formatted date (change the default date format in the config){content}
This is the contents of the clipboard (if you have selected to paste it)Here is an example Template:
Once you have created a template, it will appear as a selectable entry when creating a new note with Alfred. Also, by holding down one or more modifier keys, you can customise the result:
Here is a detailed readme that explains everything the workflow can do.
Suggestions welcome...
https://github.com/pryley/alfred-the-archive/blob/master/README.md
@pryley This is a great workflow. There is one thing: searching for a note and selecting to add a wiki link to it, the link that is pasted in has an empty space at the end before the closing brackets. If i remove the space, the link works. Think it might be a bug (if not its something with my links).
@johnny It works for me, I wonder if your notes have a leading space in the title?
Regardless, update to v1.3.1 which:
@pryley This workflow is incredible. Soooo useful. Greatly reduces friction in zettel creation as evidenced by the fact that I've added more notes in the last few days than in the last month combined. Custom templates and add image speeds things up considerably.
Every question I've had so far has been answered by your very clear documentation. Tried everything and it works great.
Also, as a young Padawan learner in the ways of Python, it's inspiring to see what's possible. Minimal and elegant. Super cool.
Much gratitude and look forward to following your work in the future.
I have added a feature in v1.5.0 that allows you to change the heading level of a line in your note using the standard ⌘ + LEVEL hotkeys, similar to the way most Markdown editors allow you do it. And unlike some other solutions, this one will not overwrite your clipboard in the process.
For example:
Pressing
⌘ + 1
will turn this: "Note Title" into this: "# Note Title"See: https://github.com/pryley/alfred-the-archive/blob/master/README.md#change-heading-levels
@pryley When I include a pipe
|
in the title and attempt to create from a template, it creates a new note but not from template. Additionally, the note title characters after the pipe are truncated. I've recreated it and, as far as I can tell, it's the pipe throwing things off. Possible to be able to create a note with a pipe in the title?@kohled Sure! Please download the latest release from here: https://github.com/pryley/alfred-the-archive/releases
@pryley Awesome!
Hi @pryley.
Installed the workflow following instructions but when I input
ar
no The Archive files are returned. Do I have to specify their location on the mac? (Note: I'm still on Mojave since I've been too lazy to do a clean install of Catalina.)================
_Research is formalized curiosity. It is poking and prying with a purpose. _ -- Zora Neale Hurston
@MJV The workflow reads the preferences from The Archive in order to determine the notes directory. However, this workflow has only been tested on Catalina so I am unsure whether The Archive manages the preference file on Mojave differently.
You can quickly perform a test to determine whether or not the preferences are being found like this:
ar
+ spaceIf the workflow is unable to get the preferences, you should see one of the following errors in the debug console:
"Warning: Cannot get the application setting: ..."
OR
"Error: Cannot find the application settings, please verify the_archive_bundle_id."
Please let me know your results.
FYI: On Catalina, the preference file for The Archive is found in the Sandboxed Group Container directory here:
~/Library/Group Containers/FRMDA3XRGC.de.zettelkasten.TheArchive.prefs/Library/Preferences/FRMDA3XRGC.de.zettelkasten.TheArchive.prefs.plist
Thanks for the message @pryley.
In my mac the preference file is at:
~/Library/Group Containers/FRMDA3XRGC.de.zettelkasten.TheArchive.prefs/Library/Preferences/FRMDA3XRGC.de.zettelkasten.TheArchive.prefs.plist
(I did a copy path). So that should not be the problem.Re: the debug info. There is indeed an error message, but not any of the ones you mentioned.
Does this help tracing the problem?
================
_Research is formalized curiosity. It is poking and prying with a purpose. _ -- Zora Neale Hurston
@MJV Please update to the latest release and let me know if that fixes it.
https://github.com/pryley/alfred-the-archive/releases
Perfect! Thank you.
This workflow is going to be SO useful.
================
_Research is formalized curiosity. It is poking and prying with a purpose. _ -- Zora Neale Hurston
Hei @pryley
Would it be possible to configure it to only link to the ZettelID, and not the title? Great job btw...
@johnny You mean when pasting/copying a wiki link?
@pryley Yes. That would make this workflow perfect.
@johnny please update to v1.7.0
@pryley Thanks for this! This workflow is a HUGE addition to my system. It singlehandedly kept me using The Archive instead of trying some new tools.
One question: I read the documentation and I was not able to figure out how to modify the "default" template (for lack of a better term). Is there a way to create a new default, or modify the one that ships with the workflow? Thanks!