Open 2 urls with specific chrome profile

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Xproplayer
Posts: 24
Joined: 12 Feb 2017, 23:26

Open 2 urls with specific chrome profile

22 Sep 2017, 03:57

Hey guys, just trying to acomplish the title. All the docs I find so far just mention opening urls or with certain profiles but not both. Just want to open 2 urls with a specific chrome profile that will not already be open (cant do winactivate and then open url)
Xproplayer
Posts: 24
Joined: 12 Feb 2017, 23:26

Re: Open 2 urls with specific chrome profile

22 Sep 2017, 04:49

Already know some of the url parameters like so https://superuser.com/questions/876243/ ... ctivate-it just need to know how to add urls to it.
User avatar
jmeneses
Posts: 524
Joined: 28 Oct 2014, 11:09
Location: Catalan Republic

Re: Open 2 urls with specific chrome profile

22 Sep 2017, 04:58

Code: Select all

#NoEnv
#SingleInstance force

ChromeUrls =
(Join`s
"https://autohotkey.com/boards/viewforum.php?f=4"
"https://autohotkey.com/boards/viewforum.php?f=5"
"https://autohotkey.com/boards/viewtopic.php?f=5&t=37347&sid=ab796fd13e8d43caad178ceebcb0bc41"
)
PathChrome := "X:\PortableApps\GoogleChromePortable\GoogleChromePortable.exe"
Run %PathChrome% %ChromeUrls%,,Max
ExitApp

Donec Perficiam
Xproplayer
Posts: 24
Joined: 12 Feb 2017, 23:26

Re: Open 2 urls with specific chrome profile

22 Sep 2017, 05:03

jmeneses wrote:

Code: Select all

#NoEnv
#SingleInstance force

ChromeUrls =
(Join`s
"https://autohotkey.com/boards/viewforum.php?f=4"
"https://autohotkey.com/boards/viewforum.php?f=5"
"https://autohotkey.com/boards/viewtopic.php?f=5&t=37347&sid=ab796fd13e8d43caad178ceebcb0bc41"
)
PathChrome := "X:\PortableApps\GoogleChromePortable\GoogleChromePortable.exe"
Run %PathChrome% %ChromeUrls%,,Max
ExitApp

I need the chrome to open with a specific profile, but this looks amazing. Whats the noenv and singleinstance force do, as I'd like to merge this with my master AHK script that does lots of other statements.
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Open 2 urls with specific chrome profile

22 Sep 2017, 05:38

Code: Select all

#SingleInstance, Force

Run, "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --new-tab --profile-directory="chromeProfileName1" "https:\\www.autohotkey.com"
SoundBeep
Run, "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --new-tab --profile-directory="chromeProfileName2" "https:\\www.theguardian.co.uk"
SoundBeep
ExitApp
Tested with two already existing/logged in instances/profiles as well as it is creating those from scratch.
As you already know, once you run it that way you can work with its separate process PIDs to trigger those instances quite reliable.
Hope that helps.
Xproplayer
Posts: 24
Joined: 12 Feb 2017, 23:26

Re: Open 2 urls with specific chrome profile

23 Sep 2017, 23:32

BoBo wrote:

Code: Select all

#SingleInstance, Force

Run, "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --new-tab --profile-directory="chromeProfileName1" "https:\\www.autohotkey.com"
SoundBeep
Run, "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --new-tab --profile-directory="chromeProfileName2" "https:\\www.theguardian.co.uk"
SoundBeep
ExitApp
Tested with two already existing/logged in instances/profiles as well as it is creating those from scratch.
As you already know, once you run it that way you can work with its separate process PIDs to trigger those instances quite reliable.
Hope that helps.
This worked almost perfect,

First I had to use "Profile 1" instead of "chromeProfileName1" but you may have used that as an intentional palceholder.
Also I was having issues with the hotkey firing multiple times and the tabs not opening in the same window. Two open more than 1 url I simply removed the --new-tab on the the first line, and add a 100-250ms delay.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Giresharu, haomingchen1998, Thorlian and 282 guests