Creating new macro with a shortcut

One of the actions I often use is “Open URL”. What I do is I assign “string is typed” trigger for this.

The problem is I need to goto KM everytime for creating that macro.

Is there anyway I can highlight the URL and press a shortcut then KM popups the string I want to assign to that URL?

Not really, no. Keyboard Maestro is, ironically, very hard to automate.

Note that you generally should not use a Typed String trigger for a global action like Opening a URL because the typed string trigger should usually only be used in a text typing context (ie, somewhere you can type the trigger, and then Keyboard Maestro can type the deletes to delete the trigger before executing the macro). For an action like opening a URL, you might likely want to do that when you are in the Finder for example, where Keyboard Maestro simulating a bunch of deletes might be quite bad. Generally it would be better to use a single Hot Key for this whole class of URL Opening macros, and then let Keyboard Maestro display a conflict palette for you to select which URL to open.

As for creating them on the fly, or creating them quickly, you really only have two options:

  • Open Keyboard Maestro (editor) and add the macro (usually just duplicate an existing macro and adjust it).
  • Create the appropriate XML .kmmacros file and import that into the Keyboard Maestro editor (ugly, but can be effective for macros that have consistent structure).

What you need is an app called Popclip. It has an Open URL shortcut. All you have to do is highlight the URL and it pops up a link icon which you press and the URL is opened.