Using text expansion with "Search the web" action

Hi i set up a macro to open a new chrome window and do a google search using the “Search the web” action. Works great except for when i use text expansion snippets that ive entered into Keyboard Maestro, in which case it doesnt process these (though they will work everywhere else). Anybody know the solution to get text expansion snippets working inside of the “Search the web” action?

Sadly, due to a technical decision by Apple on how keyboard monitoring happens, text expansions do not work within Keyboard Maestro Engine itself.

1 Like

So while you can't use a KM text expansion with a KM Macro, you can use text expansion by another app like Typinator or TextExpander.

This is one of several reasons to have another tool for text expansion, although KM does a great job in most cases.

1 Like

Hey @danklim,

While Keyboard Maestro cannot run a text-expansion macro within one of its own dialogs, it can run them in AppleScript dialogs.

Place this AppleScript into an Execute an AppleScript action and run it.

Request Text-Input from the User with AppleScript.kmmacros (2.5 KB)

Then activate your typed-string-triggered text-insertion macro in the text field of the resultant dialog.

The output will end up in the Keyboard Maestro variable dialogText.

From there you can implement your search the web action.

You can also activate URLs from an Execute an AppleScript action:

open location "https://www.keyboardmaestro.com"

Which will open the given URL in the default web browser on your system.

You can also force a non-default browser to be used:

tell application "Firefox"
   activate
   open location "https://www.keyboardmaestro.com"
end tell

-Chris

1 Like