Keyboard Maestro Automation

In the absence (yet) of actions has anyone any experience with automating Drafts For Mac with Keyboard Maestro?

Mostly interested in how easy it is to control that way, rather than specific macros to share. (Though the latter would be nice.)

2 Likes

So far I’ve made a macro to creat a new draft with a particular tag, regardless of where I am on my Mac. I brute forced it with a “click on found image” step to go to the tag field, enter the tag, and go to the body. Not sure if there is a more elegant way. I use this to quickly add a note to my “daily list” workspace.

2 Likes

I think you’re right - unless Cmd+T is good enough for you.

I hunted around for something to use like a menu item and found nothing. But then, on a hunch, tried Cmd+T. It popped up a type in for the tag, with suggestions filled in.

1 Like

Awesome, thanks. I’m going to dive in and tweak my macro.

1 Like

Let us know how you get on.

I ended up sticking with the “click on found image” behavior for this. Cmd-T would work differently depending on whether the tag field was already dropped down or not.

For those interested, here is the Keyboard Maestro macro:

You may need to take a screenshot of the tag flag at the top of a draft (hit Cmd-T if you don’t see it), and replace my image in the 5th step, for it to work on your system. You will probably also want to change or remove the default tag I’ve set in the 6th step.

2 Likes

Here’s another Keyboard Maestro macro that will create a new Mail message with the first line of a draft as the subject, and the rest as the body. To run this, make sure Drafts is the active application, and then use Ctrl-Option-Cmd + D keyboard shortcut.

Please note that I keep Drafts in the same location on my screen at all times. You may need to tweak the coordinates in the first step to get Keyboard Maestro to click at the start of the draft depending on how you have things positioned. If anyone knows of another way to get the cursor there, please let me know.

EDIT: this doesn’t work correctly in the Beta that just came out. In the step of the macro that is supposed to select all the text after the first line, the keyboard shortcut instead moves down one draft in the sidebar list.

EDIT #2: I got this working again by overriding the app’s default keyboard behavior. In System Preferences > Keyboard > Shortcuts > App Shortcuts, I added a shortcut for Drafts for “Next Draft” and one for “Previous Draft” and assigned a different keystroke than the one that shows in the app’s File menu dropdown (which interferes with text selection when using keyboard commands).

2 Likes

If you’re having to resort to click on found image that’s pretty dire.

If you’re in the beta programme could we discuss with Greg how a later beta might enable better integration?

1 Like

Hi, stumbled across this one earlier but couldn’t get the macro to work for me in Keyboard Maestro. I think its to do with the the first part of the macro which tries to position the cursor (or at least I think that is what its intended to do).

I replaced this with an AppleScript which uses System events to select the editor area and then using keyboard commands copy the very first line of the draft. I am not an expert in AppleScript and if anyone can improve upon I would appreciate. I have copied out the script I wrote below. This replaces the first part of the Macro above up to the first Copy to Named Clipboard (Mail subject Drafts).

activate application "Drafts"

tell application “System Events”
tell process “Drafts”
select scroll area 2 of splitter group 1 of window “Drafts”
key down command
keystroke “a” using command down
key code 123
key code 124 using {shift down, command down}
keystroke “c” using command down
end tell
end tell

I would have uploaded the macro but I can’t figure out how to do it.

I have been using KBM for years. For most apps, I have both an always active shortcut macrogroup and a palette based group.
For some bizarre reason, which does not make sense, KBM shortcuts often do not work with Drafts. For example, I am unable to create a shortcut which triggers Editor→ Link Mode which I often activate / deactivate when I am working in Drafts. Using a palette, the macro works fine, but not using a shortcut. I tried all different kinds of shortcuts, made sure my macro group is configured correctly, tried all kinds of macro variants from open menu item to click on image (the small link image at the bottom).
As I said, I have been using theses types of macro group / shortcuts with many many apps in the past and have only very rarely had problems (usually with toggling menu items).
Do you have any idea where the problem may be? Are you able to activate the Link Mode with a shortcut ?

Any chance the keyboard shortcut you have chosen is conflicting with something else? Does it work if you use a different shortcut? What about other trigger methods other than the palette?

1 Like

thank you for your reply. I must have tried 10 different shortcuts. Non palette, non shortcut triggers: I don’t know what I would use.
Basically if anyone uses KBM and can trigger link mode with a keyboard shortcut, then I am in the wrong.
I will try BTT using a gesture

it works with BTT, so I will simply use BTT
IMO a quick way to trigger link mode is essential: I do it 50 times a day, so BTT is even better.
thank you for your post.

Have you tried anything like this? It seems to work for me.

1 Like

It works. I quit. I’m booking a lobotomy first thing next week. Very sorry for having taken your time.
I deleted and re-created the macro group and macro. No clue what the problem could have been.