How to Switch Focus to a Different Specific Chrome Window (Not Just a Tab)?

I've spent an hour or so poring over the KBM manual, wiki, and forum, looking for how to switch to a specific Chrome window, and all the info I find seems to presume that I'm dealing with finding tabs within a specific window. Not my situation.

Has anyone else dealt with this successfully?

I found a Chrome extension called Tabs that displays the names of ALL open tabs, not just the current window, and lets you search among them. I think if I put the tab title in the search box, it should show me just the tab I want, and then I can click that and I'll be switched over to the window (and tab) that I'm looking for.

If there's an easy way to do this within KBM, I'd love to try that.

Thanks.

Have you tried the Manipulate a Window action, based on the Window Title or Index?

Thanks Michael,

Index, I think, only lets you choose between tabs in a single window; at least, that's what I've understood so far. Do you know how to get the index of a window by title?

The Manipulate Window action (in Interface Control) didn't do it in my testing, when I used "the window with title".

Action Failed
Manipulate Window could not find any matching windows

I can get there as a Chrome window multiple ways:

  • Command+` will cycle between the open Chrome windows in both screens of my current desktop.
  • It shows up by name when I right-click the Chrome icon in the dock.

Then I tried "windows with title containing" and that worked.

Go figure...

Thanks.

@August
This helped me: Switch to named tab in Google Chrome

1 Like

Nope. Window Index and Tab Index are two different things.
Try the Manipulate a Window action using different index values and it should become clear.

Yep, that's often the best approach because you can't always be sure what all an app will put in the Window Title.

I don't see any extensions on the Chrome store named ‘Tabs’.

Could that possibly be ‘Quick Tabs’?

If not please point out the correct one.

-Chris

Hey @August,

Easy?  Nyet, I'm afraid not.

Aside from window information/manipulation where I expect Peter depends upon the macOS window manager, I believe all of KM's Chrome functions depend upon AppleScript under the hood.

Google has some weird ideas about how they reference tabs by tab ID but the active tab by tab index – and this makes bringing a given tab to the front more difficult than it should be.

There ought to be a global active tab property in the application class, but there's not.

The available active tab property is local to the window class, so you've got to jump through some hoops to activate both the window and the tab.

But – the job is doable.

Here's a no-frills Go-To-Tab macro.

You get a smart pick-list that allows typing one or more strings to be searched against the list of tab names.

Go To Google Chrome Tab by Name v1.00.kmmacros (9.5 KB)

Personally I prefer the AppleScript dialog based method I use in this macro:

NOTE – the macro linked here is for Safari and is not directly translatable to Google Chrome – they have significantly different AppleScript dictionaries.

The search is not as good, as it only has type-select and not a true word search – but I find the font easier to read – and the dialog will expand up to screen-width if the contained text is large enough.

If I was going to use a macro like the Go-To-Tab macro above on a daily basis I'd probably have to break down and use a Custom HTML Prompt action, so I could tweak it more to my liking.

@DanThomas has made that especially easy:

MACRO: Spotlight Search Prompt

You really ought to scope out his other masterwork as well:

MACRO: [KMFAM] Favorite Actions and Macros

-Chris

1 Like

This is actually very easy to do using KM non-script Actions.

Below is just an example written in response to your request. You will need to use as an example and/or change to meet your workflow automation needs.

Please let us know if it meets your needs.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

MACRO:   Select Window by Index [Example]

-~~~ VER: 1.0    2020-12-19 ~~~
Requires: KM 8.2.4+   macOS 10.11 (El Capitan)+
(Macro was written & tested using KM 9.0+ on macOS 10.14.5 (Mojave))

DOWNLOAD Macro File:

Select Window by Index [Example].kmmacros
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.


Example Output

image


ReleaseNotes

Author.@JMichaelTX

PURPOSE:

  • Select Window by Index [Example]

HOW TO USE

  1. First, make sure you have followed instructions in the Macro Setup below.
  2. Make the Target App Frontmost.
  3. Trigger this macro.

MACRO SETUP

  • Carefully review the Release Notes and the Macro Actions
    • Make sure you understand what the Macro will do.
    • You are responsible for running the Macro, not me. ??
      .
      Make These Changes to this Macro
  1. Assign a Trigger to this macro.

  2. Move this macro to a Macro Group that is only Active when you need this Macro.

  3. ENABLE this Macro, and the Macro Group it is in.
    .
    REQUIRES:

  4. KM 9.0+ (may work in KM 8.2+ in some cases)

  5. macOS 10.11.6 (El Capitan)+

TAGS: @Windows @Example

1 Like

Nope, not Quick Tabs.

It does not turn up in searches, for some reason. It may be that the very short, generic name gets hidden by all the other names that contain the same term, but that's a guess.

Here it is:

1 Like

Wow. Very thorough tutorial! I will take a deeper look at this. Just from an initial skim I've learned a LOT!

I've gotten distracted into a different project for now, so it may be a little while before I get back to this. I can already see other ways to use these concepts.

Thanks,
August

1 Like

If you're trying to switch easily among windows (or tabs, or apps), my advice is to skip KBM entirely (fabulous though it is) and use Witch, a fantastic and powerful switcher tool that I have relied on for more than a decade: https://manytricks.com/witch/. It will cost a few bucks, though.

I just figured this out- if you use the "Name Window" (hit the three dots at the top right of your Chrome window, select More Tools-Name Window) then you can use the Manipulate Window action with the "window name containing" option in "Google Chrome"

image

Hi Dave,

Welcome to the forum and thanks for the tip. I did not know about that feature and I can definitely make use of it in various situations, especially in getting back to a tab that I'd been in, when the default name is the same as many other tabs.

When I posted the original question, 20 months ago, I was thinking that this would be a solution to part of a problem that I was trying to figure out, one step of a multi-step macro that involved switching back and forth between different Chrome windows.

It turned out that looking for and exact match of Chrome title wasn't working and that when I looked for "Title Containing: ___" then it worked much better. The feature you found will definitely help in more complicated situations.

Thanks.