Feature Request: Subroutine for validating actions for macro group

I can implement this manually, but a built in feature would be pretty handy.

Most of my macro groups are categorized by websites that I visit in a browser (Usually Chrome), and I can check the title of the window to enable macros from that group.

However, while websites often change their page titles, domains, and top level paths often don't change, so that's a good way to validate whether this macro should run. To do this, I can run a subroutine at the beginning of each macro in a macro group and cancel the macro if something doesn't match (domain, etc). However, doing so has several inconveniences.

  1. Obviously, I need to paste this boilerplate code into each macro I create which is cumbersome and I may forget to do so.

  2. If I use this as my main method of validation, the hotkey that I assign to my macro may still conflict with another macro in another group which isn't validating on the same domain.

My feature request would be a special macro or set of steps which can optionally run in a group to conditionally enable the group. Let me know if there's another way of doing this which would make more sense, but I have countless instances where this kind of feature would be useful.

Thanks!

1 Like

As far as I can see you're asking for a macro group activation parameter that would watch for a given website to be active in your web browser.

Many people have asked for that feature, but it's not practical. Keyboard Maestro would have to constantly poll the browser (very inefficient) – and for that matter not all browsers have an API that allows for them to be polled.

If you're desperate for this feature there's a tricky method that might do the job, but you'll have to work for it...

How To Trigger Macros Automatically From Google Chrome

3 Likes

Hell yeah. This is exactly what I need, and I'm embarrassed that I haven't coded it myself now that I think about it.

Thanks!

2 Likes

Glad that worked for you! I think it's a very clean method for triggering macros based on browser activity.