76: Automating with Alfred

Copy Path to Clipboard is very handy. I also use Copy name by Maclej Skrzyypczak, tied to hyper-C, to pass the names of files around the place.

1 Like

Not Alfred but Cardhop has a nice feature for this: Invoke with keyboard shortcut and just type mail followed by the name of the person in your contacts you want to mail. Works with call, FaceTime etc too.

If you mean just open a window to a write a blank email message without opening the Main Mail window, a URL could do the trick mailto: with no further info.

In order to use that into Alfred, you could:
(1) create a Custom Web Search (if you rather want to type a command on Alfred window); or
(2) create a workflow (if you want it to be triggered by a shortcut or snippet)

The fastest rout will be to create a custom search like this one:

Then, every time you type email into Alfred, you’ll get that window waiting for you to type on.

The trick here is that “Custom Searches” can be used even without an argument to it, just to invoke an URL. In fact, that same trick can be done for every single URL you want Alfred to have quick access.

Thanks. I’ve never really looked Cardhop because I don’t really do all that much with contacts. On the other hand, I have and love Fantastical, which I bought 6 years ago, so it might be worth considering a Premium subscription.

1 Like

Thanks for that. The problem is that it opens Mail.app which shows me the inbox, and that is what I want to avoid. I do not want to be tempted to check mail except during my “mail” time blocks.

I know the real answer is personal discipline, but that is in short supply here.

I loved this episode. I have a question about Alfred. How can I get it to open an app or file on the ACTIVE display and not the default display. I have changed the Alfred appearance options and Alfred itself will open it’s search box on the active display but from there when I launch an app it won’t launch it on the active display. Anyone know how to do that?

1 Like

I fell your pain. If you happen to have Keyboard Maestro on your tool belt, take a look here:

The trick for this macro to work is find a reliable way to set the “Focus” variable to on or off depending on your work routines. Mine is tied to Focus App: whenever a Focus session is starts/stops it will trigger a Keyboard Maestro Macro that will set this variable to on/off.

If your hours are more fixed, you could create a Macro that will turn the “Focus” variable on/off depending on certain hours. Or even use those Mail Hours instead of the “Focus” variable altoghether. Like this:

In that case, Mail will close its inbox window between 15:00 and 16:00. You can set your own schedule accordingly.

That’s very clever but frankly, a bit more than I want to get into. I don’t currently have KM, although I am sure that if I did get it I would find things to do with it. For now, I think the python solution will be a good one for me to use to learn too.


Take a look at ScriptingBridge module. It allows for window manipulation if you want to reproduce the logic of those macros on Python.

1 Like

Wouldn’t Drafts be a good solution?

Sure, for many cases it totally is.

For me I’d rather stick to my Rube Goldbergian approach for two reasons:

  1. Using Mail’s compose lets me use its address autocompletion feature;

  2. It lets me open links to a specific message (which will open in ifs own window) without opening the inbox window.

Oooh…you want Keyboard Maestro, you just don’t realize it yet. Promise!


I have several playlists in Apple Music that I tend the listen to quite often. Is there an Alfred workflow that will bring up a list of designated playlists and let me select one? I searched Packal, but they seem to be way behind and are only maintaining Alfred 2 & 3.


If anyone is still looking for more Alfred goodness, I’ve just released an update for the Drafts workflow I created that was mentioned in the episode and earlier in this thread.

I’ve added the details of what’s in it over in the workflow’s thread on the Drafts forum, but if I say the biggest addition in the release is a set of ‘File Actions’, hopefully that will give you an idea of what to expect.


There is the built-in miniplayer. Type “itu” to launch it, then type “play” to get to your playlists and then you will see a list of your playlists. Then you can type the first few letters of the playlist to select it.

1 Like

oh boy, I learned so much with this episode and from the discussions here.

One thing always puzzled me and I hope that Alfred can solve for me.

I always want to set ‘advance search’ as default when I google

As an example I only want to see my search results that have been updated or created in last month, I have to go to Advance Search setting and enter 1 month

Can I set up a custom search in Alfred to automate this. If Alfred cannot do this, is there any other way (guess keyboard maestro ?)


I think I found the answer after search the Alfred Forum

let me know if anyone has additional thought to share, thanks

Thanks, Dom. I think that might do it. It looks like if I want to concentrate on a particular set of playlists, all I have to do is use a unique character in the title to, in effect, create a “group.” I’ll have to play with this.


For anyone making use of my Alfred Workflow for Drafts (aka “Doctor Drafts”), an update is available.

PSA: There are some new updates to some of the Alfred workflows mentioned in this episode.

To accompany the new universal actions feature in the Alfred 4.5 release, these are now available in my Alfred workflow for Drafts; as well as some other new functionality as well :wink:

Basically, several new options around getting content into Drafts, and also for searching for Drafts-related things.

Also, for anyone using my Alfred workflow for Keyboard Maestro, Conductor, a new version of that is available that includes some fallback search options for macros.

If you forget the trigger, start typing in the name of the Keyboard Maestro macro, then select the execution option.

At that point you can select the macro that matches and execute it.


1 Like