Move ( Detect ) Specific Chrome Tabs or Window

image

I open 2 chromes at the same time. They are all different windows.

And use Macro A for chrome A
And then use Macro B for chrome B
I create Macro C which includes Macro A and then Macro B...

But I can't find a way to detect Chrome A, B...

1 More question.

Is there any way not to open the URL by a new window?
Is there any way not to act this action ( Open URL ) if there is already opened?

Thank you all the time :slight_smile:

Hey Sasi,

I don't understand what you mean...

Two different versions of Google Chrome? Or what?

To open a new tab:

image

You can manipulate windows with the Manipulate a Window action.

Use the action inspector or the insert action by name menu item to search for available actions.

You can also use the search field in the Keyboard Maestro Editor's help menu.

Don't forget the Keyboard Maestro Wiki.

You can manipulate Chrome quite a lot with Keyboard Maestro native actions, but to get really sophisticated you'll have to resort to AppleScript.

-Chris

1 Like

If you are trying to execute a macro on a specific window, it's a matter of first having that macro find the application window that has or contains the title of whatever chrome window you're working with. You can accomplish this with "manipulate a window" action. If you need to search for a window that's buried in TABS, then you will need to use AppleScript.

I used to have an AppleScript that would accomplish this, but I moved away from using Google Chrome awhile back and I am not sure if my AppleScript will still work with the current iteration.

As for your other question, you don't need the "activate GC" action before opening a URL. The open URL action will open the browser assuming you use the specific browser open URL action as can be seen here

Screen Shot 2021-07-13 at 15.27.28

This KM token will list the names of ALL windows that are open for a given app:
%WindowName%All%

If you want a list of the URLs of the active tab of all Chrome windows, then you will need to use a simple script:

tell application "Google Chrome"
  set urlList to URL of active tab of every window
end tell
return urlList

Given a KM Variable with a list of window names or URLs, you can easily check to determine if any window is already open:

image

I use a RegEx matches comparator to determine if any LINE in the list STARTS with the URL:
(?im)^%Variable%NewURL%

Does that answer your question?

2 Likes