Trigger Macro if Chrome Title (Or URL) Contains a Certain String?

I want to build a website specific macro. What I'm looking for is a macro that triggers when the title of a chrome tab contains a specific word. I've seen "Focused window title changes" but it doesn't seem like I could apply a condition for that, right?

Alternatively, it could work when the URL of a crome tab contains a specific string. Does that exist?

Thank you.

Hey Peter,

Chrome doesn't broadcast to the system when its URLs or (non-frontmost) Tab Titles change, so Keyboard Maestro can't have a trigger that involves those.

You can trigger on changes to the focussed window, but that doesn't help with hidden tabs or windows that are behind window 1.

The best you can do is to have a periodic trigger that scans all the window/tab titles and/or URLs, and to do that you have to know a bit of AppleScript.

-Chris

Hi Chris,

thank you! I thought something like that. A periodic trigger does not work here since this is a very time-sensitive thing. I would've to set it to something like "every five seconds" which could then be hard on the CPU i guess.

Anyways, I found another (quite ugly?) way to accomplish that: there is a group which gets active in Chrome and the window title matches a specific pattern. (The target URL has a fixed window title that changes to sth completely different once the trigger gets activated, so we're not in a loophole here. And of course the target window/tab must be active for that.) The actual macro triggers when the focused window's title changes. It will execute an IF THEN action: IF the URL contains this certain piece of string THEN execute the macro. The OR section is just empty.

ATM this works for me and that's fine. Nonetheless, I'm a quite unexperienced user of KM but even for me this looks really bad. Is my solution a CPU intensive one? If someone has a nicer solution I'd be happy to here about it! :grinning_face_with_smiling_eyes:

Thank you.

Look in the Activity Monitor app and see.  :sunglasses:

-Chris

I think you're right, but I'm not sure about the numbers here. Do you have any experience reading that? This is my CPU screen:

10 threads is not much I guess? This is the Memory screen:

The only thing that stands out to me is the disk activity:

So far, the engine has read about 1.3 Gbyte. Is that a lot? Is that normal? Is that good?

That does seem like a lot...

@peternlewis – what do you make of this?

-Chris

Beats me, I don't even know what the OpenAndSavePanelService is. Something related to Open File dialogs I presume. There is a few matches on the web for it, mostly complaining about it using lots of CPU. Another one of Apple’s stellar bugfree services…

2 Likes

Hey @Petta,

Please Get-info on the two OpenAndSavePanel services, copy the open file paths to a text file, zip it, and post it here.

I also recommend that you reboot your system and look again.

-Chris

Thank you. I don't know what you mean with Get-info so I hope I've done the right thing:

filesandports.txt.zip (2.3 KB)

I pasted the entries for both processes in one .txt file, the one with QuickLook... starts around line 200. I looked into the output and the only things that stands out to me are the MindNode, Omniplan and Ulysses lines. These apps are not installed on this computer (but they have been on the one that I've been using before).

Will do a reboot now and see what happens.

Sorry I meant View › Inspect Process.

image

It looks to me like you did exactly the right thing.

Those processes do not belong to Keyboard Maestro, so I'm not sure what to think.

Maybe the (Keyboard Maestro Editor) means the KME was the last process to access the Apple subprocess..

You can Google if you want to know more, but don't bet on finding anything significant.

-Chris

1 Like

Okay. This is how it looks like after the reboot:

Back to normal I guess. Thanks again for looking into it!

1 Like