Typed text
Runs the macro when you type a string of characters, in any app.
string is typed
Keyboard Maestro: TypedString
Details #
Switchboard keeps the last 64 characters you typed and fires as soon as they end with your string. The typed keys are never swallowed: the app sees every character, including the ones that make up the trigger. Matching is not case sensitive unless caseSensitive is true. When two strings both match the end of the buffer, the longest wins. After a match the buffer is cleared, so the same characters cannot fire twice.
What you type is tracked until you do something that is not typing. These reset the buffer: any Command or Control chord, Return, Tab, Escape, the arrow keys, Home, End, Page Up, Page Down and Forward Delete. Backspace removes the last character. A key that makes a control character also resets it. Only keys the keyboard tap sees count; pasted text and text typed by Switchboard's own steps do not.
{{triggerValue}} holds the string that matched. With matchCase on it is an object, {typed, case}, where case is lower, capital or upper (see below); {{delimiter}} is not a variable, the delimiter is typed back for you (keepDelimiter).
delimiter. By default the macro fires the moment the last character is typed. Set delimiter to space, tab, return or any and it fires only when the string is followed by that key (any is a space, tab, Return or punctuation: the way macOS Text Replacements work). The abbreviation is deleted on that key's release, so the app has seen the whole word first. With keepDelimiter on (the default) the key you typed is put back after the expansion; turn it off to swallow it.
matchCase. Match the abbreviation without regard to case, and tell the macro how it was typed: ;addr is lower, ;Addr is capital, ;ADDR is upper. A snippet body follows it: lower types the body as written, capital capitalises its first letter, upper types it all in capitals. Text you filled in with ask, a selection and the delimiter are never recased.
wordStart. The string only fires at the start of a word: after a space, punctuation or at the start of what you typed. cat never fires inside locate, and ;addr never inside address;addr. Snippets turn this on.
simulateDeletes. When true, Switchboard presses Delete once per character of the string before the macro runs, so the trigger text disappears. Pair it with a Type text step to build a text expander.
Secure input. While secure input is on, nothing runs and the Not fired list records secureInput.
Conflicts. The same string in two enabled macros with overlapping scope opens the Conflict palette ("typed ... is used by 2 macros. Pick one to run."). A macro in an app-scoped Group wins over Everywhere when its app is in front.
Scope. The front app at the moment of the last key is checked against the Group scope.
Permission. Needs Input Monitoring, like hotkeys.
Parameters #
| Parameter | Type | Required | Values | What it does |
|---|---|---|---|---|
string | text | Yes | The characters to watch for. Empty never matches. The library check warns about strings shorter than 2 characters, because they would fire as you type normally. | |
caseSensitive | yes / no | Match upper and lower case exactly. Off by default. | ||
delimiter | one of | none space tab return any | none (default, fire at once), space, tab, return or any (space, tab, Return or punctuation). The string fires when this key follows it. | |
keepDelimiter | yes / no | With a delimiter, type that key again after the macro. On by default. | ||
matchCase | yes / no | Ignore the case of the abbreviation and report how it was typed (lower, capital, upper) in {{triggerValue}}. Off by default; on for snippets. | ||
simulateDeletes | yes / no | Delete the typed characters before the macro runs. Off by default. | ||
wordStart | yes / no | Fire only at the start of a word. Off by default; on for snippets. |
Every trigger also takes Limits: a cooldown, the first time each day, every nth time, twice within seconds, a chance, only while you are at the Mac, on one Mac, or in a State. See Limits on any trigger.
Examples #
- Type “;sig”
- Type “Best regards, Sam”
Gotchas #
Pick strings you would not type by accident. Prefix them with a symbol such as
;.If the string is also the start of a longer trigger, typing the short one fires first.
With
simulateDeletes, the deletes are sent as key presses to the front app. In an app that autocompletes, they can remove more than you expect.Not fired reasons:
scope,conflict,secureInput,paused,conditionFalse. A macro that is off or in a Group that is off is not listened for at all.