changing hotkey action depend on which chrome profile is currently active
Posted: 27 Apr 2022, 02:31
Due to my work, I often have a lot of chrome profiles open simultaneously, and I want to make a single set of hotkey perform different action depend on which profile is currently active.
To better illustrate the point, the final code would look something like this:
The problem is ahk doesn't seem to have any built-in way to tell the different profiles apart. Their ahk_exe, ahk_class, ahk_pid, wintext are all exactly the same. I can't rely on WinTitle, since it changes depend on which tab is currently in focus, and they can overlapped. I'm thinking of using the pixel color of the chrome profile avatar, but then if I resize the browser window or change the avatar image, it'd become useless.
Could someone help please?
To better illustrate the point, the final code would look something like this:
Code: Select all
$^+x::
If WinActive("ahk_exe chrome.exe")
{
If <Profile 1 is active>
{
FileEncoding, UTF-8
FileRead, Clipboard, %UserProfile%\Dropbox\AutoHotkey Automation Scripts\Insert TXT\CannedResponse.txt
Sleep, 10
Send, ^{v}
Return
}
If <Profile 2 is active>
{
Send, ^{w}
Return
}
If <Profile 3 is active>
{
MouseClick, left, 40, 25
Return
}
}
Send, ^+x
Return
Could someone help please?