Alternative keyboard shortcuts to run Drafts with arguments

I have used an app for many years called MBraille. MBraille is an app that allows blind users to type braille directly on their touch screens.

The developer of MBraille invented a series of very nice commands. He called those dot commands. A dot command would be a dot (.) followed by a command and the possibility to include arguments. For example the following command would send all text above the line where the command is as a text message to John Smith.

.sms john.smith

So in essence MBraille searches the contacts on the device until it find a match. That means one could type:
.sms jo.smi
and still get John Smith as the result.

If .sms was typed by itself the message screen would be shown and a contact must be added manually.

Is it possible to create actions that would allow this behaviour inside Drafts?

The action should basically do something like the following:

Act on .sms followed by a press of the return key.
Use the text above the .sms command and paste that as it can do when launching the regular message action.

Search contacts on device until it find a match.

I don’t think this is possible using Drafts alone. I think you could get close by creating a custom Drafts action that looks at the current line, checks to see if it begins with (using your example) .sms, then sends the preceding line and the contact name to the macOS / iOS Shortcuts app. From there, Shortcuts would do the heavy lifting, searching through your contacts and etc. But Drafts doesn’t actively monitor what’s being typed for the purposes of triggering an action—you’d need to assign a keyboard shortcut to the action. Something like ⌥⌘M maybe. If you’re only working on macOS, you could throw Keyboard Maestro into the mix and trigger a macro when a particular string is typed.

2 Likes

Thanks for this. Do you have any idea of some sample actions I could look at? I have no programming skills at all, but I have tried to use the keyboard shortcuts. That is a great functionality, but in some cases I tend to focus more on the task instead of the shortcuts, so I keep forgetting which one to use when I am done typing. :slight_smile: The MBraille workflow helps me staying focused on my work while I use Drafts, so if I could somehow integrate this into Drafts actions it would be very cool!

MBraille does not seem to support any custom definitions, so while the .web dot command could technically trigger a Drafts action, the URL would be too unwieldy to remember and type out in daily practical terms.

You can trigger actions by name from the Command Palette as well as various other searches, and that would mat likely be your best option with what is currently available - utilising input prompts to capture additional data such as the name of a contact to search for.

If you really want to be able to type in the editor and then trigger an action to process a command, I did create something for slash commands several years back that could do that and you can tailor to your own needs.

As @garbonsai noted, it may well be that for some of your desired requirements that the action would call out to Shortcuts to fulfil them. Shortcuts can also capture text such as search terms via dictation if that should happen to be a preferable form of input - it often is for me just due to my poor typing skills :laughing: