Google Chrome Profile - Shell Script

I want to open multiple URLs with Google Chrome in a specific Profile.

I got a shell script from this forum, but I don't know how to modify it to open Multiple URLs in the same window. 'Google chrome Tab with URL' open's a new window instead.

TIA

open -na 'Google Chrome' --args --new-window --profile-directory='Profile 1'  "https://mail.Google.com/"

image

I think i figured out

open -na 'Google Chrome' --args --new-window --profile-directory='Profile 1'  "https://mail.google.com/" "https://mail.google.com/" "https://mail.google.com/"

If there's a better solution, feel free to reply.

1 Like

I think that's your best bet. Don't forget that you can also store your URLs in KM variables and feed them into your shell script (lots of examples of that sort of thing on the Forum) so you aren't restricted to "hard-coded" addresses.

The problem is that you are opening a second instance of Chrome with a different profile. At best KM doesn't know which instance to to send actions to and has to guess -- more likely it will always target the first instance that was running.

You might be able to do what you originally tried if you Quit Chrome and then launch it with your chosen profile, so there's only one copy of the app running, but I'm guessing you don't want to do that.

Hey Guys,

This can be done pretty easily with only Keyboard Maestro native actions.

  • Select the profile you want as needed.
    • checking to see what profile is frontmost as needed.
       
  • Employ the New Google Chrome Tab action as needed.

Pretty simple.

The shell script solution is way more cool of course... :sunglasses:

-Chris

1 Like

@ccstone
Do you have example to demonstrate this? Just curious.

You can check a menu's status similarly to this:

Check Profile.kmmacros (5.7 KB)
Keyboard Maestro Export

Or you can just use a Select or Show a Menu Item action to select the profile you want to work with. If it's already open it will be brought to the front – if it's not open it will be opened.

1 Like