An Alfred Workflow for Drafts

I did have a look at that previously and couldn’t figure it out. However, you nudged me to take another look. I’m pretty sure that I have it working now and will include it in the next update.

2021-04-26-19.27.16

I don’t know when that will be, but sometime in the next week or two is pretty likely.

2 Likes

Hi @sylumer your work is amazing.
However I have an error when typing Vietnamese. It turns out totally different. I suspect there is some kinds related to Unicode but not really sure. Here are some pics about it.

2021-04-29 at 4.03 PM

Here is the sentence: " ngày mai em đi, biển nhớ tên em "
Is there anything you can do about it?

Thank you for your work!

Thanks for the kind words. I expect that you are correct and it is a Unicode translation issue somewhere.

Which particular commands have you noted an issue for this? There is a bit of variation in how they all work, so knowing which are affected will hopefully help me narrow down where to start looking for the cause and figuring out a fix.

Here is the input in Alfred using the workflow:

2021-04-29 at 4.02 PM

I have just tried this one. I will try more later. Thank you @sylumer

Well that’s an interesting bug that looks to only occur for the combination of accessing environment variables from an AppleScript run in an Alfred workflow. It isn’t pretty code (AppleScript rarely is to my way of thinking), but I have a solution that now appears to work with the example text.

It is a long weekend in the UK (Monday is a public holiday), so I think the chances are good that I will put up a new version of the workflow (and documentation) at some point in the next 3-4 days that includes this revision; as well as some workspaces updates, and maybe even some more? I have some ThoughtAsylum Action group updates coming along too, so it is just a case of making the time to fit this in and to also have a bit of family relaxation time and do some extra curricula work-related exams too.

2 Likes

Very thoughtful of you @sylumer
Thank you very much for spending time on this.
Have a good weekend!

v1.0.1 of the Doctor Drafts Alfred workflow for Drafts is now available from the web site.

Sporting …

  • The new live workspace filtering (includes the standard “Default” workspace too) in drws (open workspace by name) for @derekvan; and
  • The UTF text fix in drnew (create new draft in background now (hopefully) supports accented characters such as Vietnamese in content and tags) for @Weasley_Blue.

The web site documentation also has notes for these changes and a slightly updated dr flow diagram.

If either of these don’t seem to work as expected, let me know. It has only been me testing these updates, so there’s a margin for error there :wink:


I did consider working on a couple of other things for this release, but instead I did some changes for the web site and went for an earlier release. On the web site, watch out for:

  • The navigation was broken for mobile and other narrow windows, but is now fixed.
  • I’ve enabled the site wide search (which previously was also broken).

If people do have additional requests, feel free to post them, I don’t promise to add everything, but I do promise to consider everything.


Do let me know about any bugs. I’d like to fix as many that come up as I can.


Just a reminder, if anyone has built any interesting custom workflows based on Doctor Drafts, do please share some details. There are several walk throughs in the Use Cases section on the site for ones I think people might find useful, but I’m hoping that people will also come up with some additional ones.

3 Likes

you’re the best! have a great holiday and get some rest!

1 Like

Thank you @sylumer . It works beautifully!
Let me buy you a coffee!

1 Like

What is the upgrade method? Install the new and delete the old? Or is installing the new going to overwrite the old for me?

I guess I should experiment… :slight_smile:

just install the new, it will do the rest for you.

2 Likes

Fantastic tool.

I can confirm that drfind won’t work without Python 3 installed, and would suggest changing this copy “Some of the functionality Doctor Drafts uses Python 3 script” on this page to calling Python prerequisite, period.

Might be worth also mentioning up front that Python requires XCODE which in turn requires 40g of disk space - significant even in this day/age.

Thanks :slight_smile:

Not all of the functions require Python 3, so the statement is correct. If you scan through the workflow, you can see which flow chains rely on Python scripts. I might add some notes as to what they are in the next documentation update to clarify what it encompasses. But as a general rule, you can expect it to be anything where Alfred is filtering data live as you type.

Note also that some actions will require a Drafts Pro subscription due to the automation features they use or the Drafts features that they use.

For these reasons, I’m trying to present it as a more compartmentalised set of functionality rather than blanket pre-requisites. It is technically more accurate this way and leaves the door open for people to get functionality from it even without Python 3 or Drafts.

Who knows? Maybe Apple will one day include Python 3 rather than Python 2 by default?

While that might be a Python 3 Mac installation requirement, it is not a requirement for the scripts that Doctor Drafts uses. I don’t really want to start going down to the n-th degree as I don’t provide the instructions on how to install Python 3. If someone goes to install Python 3, the prerequisites for that should be covered by those instructions and details.

I’m in no way an expert on this, but I think it should only need the Xcode command-line tools. I think the installer uses the tools are used to do tool compiles from source code as Python 3 is installed. I think you can install them separately and it should take up a lot less space.

Any actual reason to hold back on using Python 3 as a baseline? Other than it’s not technically required for some actions?

(Recently, after some warning, I went for 3.8 as my baseline. But, of course, you probably have more users than I do.)

No. That is the reason. Most of the actions do not require it.

Then I think you’ve made it over complicated…

… Most users can install and run Python 3. (I was going to say “not even my 3.8” but you’d have to work at it to get a lower level.)

… What’s not acceptable is to require programmers to rewrite their code as Python 3. (And that isn’t in play here.)

Anyhow, it’s very much your decision what the prerequisite should be - for a much-appreciated contribution.

I don’t have Xcode installed. Just the command line tools. Python 3 is installed and this Alfred workflow works as advertised.

Yep, confirmed (though it says otherwise on the linked guide to Python3 installation).

That workflow is really impressive, most likely it’s also the biggest Alfred workflow I have seen (and I have seen at least hundreds).

I’ll be honest here, as I use Drafts very differently, I was virtually only interested in the ability to find Drafts and populate the results inside Alfred. After about an hour I could find what parts of your gigantic workflow I actually needed for that. Turns out, its one python script (find.py) and two actions :stuck_out_tongue:

Nevertheless, kudos for it. :slight_smile:

Your json for searching the Drafts Script Reference is also useful. I assume you keep it on a github repo to keep it updated?

1 Like

Don’t forget the documentation site is searchable and you are advised to read the section on basics. It should have taken a few minutes at the most to find what you were looking for.

The page on the basics provides an overview of all of the built in trigger flows and is a good way to quickly peruse what is available.

All of the searching flows also have their own page providing a more detailed look at what they do.

Don’t forget, as per the docs, the advice is to use the external triggers over duplicating, unless you are tailoring the script. That way if I make any changes (improvements, bug fixes, etc.), they will be incorporated automatically for your own custom flows when you update the core workflow.

Yes. This is covered in the documentation for each of the search flows. Each uses a different repo file. For the scripting search you can find all the details here.

1 Like