How to activate specific chrome tab

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Sdk

How to activate specific chrome tab

16 Oct 2017, 02:06

I wrote a hot key to copy only numerical, and I was successfull, I want to run the specific hot key into one specific tab in google chrome, I used #ifwinactive and successful in 50%. The main problem to is I want to run the hot key in specific tab titled “my page-v”
And I don’t want to use acc library, is there any other way to do this
Regards
Sdk
User avatar
boiler
Posts: 16767
Joined: 21 Dec 2014, 02:44

Re: How to activate specific chrome tab

16 Oct 2017, 12:49

Do you mean that the tab is open but not the currently active tab? You can activate Chrome, then send control-t to change tabs until the window title indicates that the desired tab is active.
Sdk

Re: How to activate specific chrome tab

18 Oct 2017, 00:08

Thanks boiler for the response
No, it’s like I have written a hot key to expand a name

@sdk::
Sdksdksdk
Return



I want to execute this hot key in only one particular tab, like I have opened three tabs gmail, outlook and yahoo, now I want to execute this particular hot key in game l tab only.that means it has to be execute only in gmail
Sdk

Re: How to activate specific chrome tab

18 Oct 2017, 00:23

My code is like this

#ifwinactive, ahk_class chrome_widgetwin_1
@sdk::
Send, sdksdksdk
Return

It works in every chrome tab, but I want it to work in specific tab
User avatar
boiler
Posts: 16767
Joined: 21 Dec 2014, 02:44

Re: How to activate specific chrome tab

18 Oct 2017, 07:30

That's even easier. For the WinTitle in #IfWinActive, just use the actual title that Chrome becomes when that tab is active. Use the Window Spy tool to verify, but it's basically the name of the tab. For example, when this page is active, its title is:
How to activate specific chrome tab - AutoHotkey Community - Google Chrome

You could include the class like you have if you'd like, so it would be:
How to activate specific chrome tab - AutoHotkey Community - Google Chrome ahk_class Chrome_WidgetWin_1
Sdk

Re: How to activate specific chrome tab

19 Oct 2017, 04:30

Thanks boiler,
I am always thinking out of the box way,
You made it simple and clear
klk123
Posts: 1
Joined: 09 Apr 2021, 13:29

Re: How to activate specific chrome tab

09 Apr 2021, 13:54

Hi, i need your answer but I cant read it. can you send the answer again please?
thnak you!
boiler wrote:
18 Oct 2017, 07:30
That's even easier. For the WinTitle in #IfWinActive, just use the actual title that Chrome becomes when that tab is active. Use the Window Spy tool to verify, but it's basically the name of the tab. For example, when this page is active, its title is:
How to activate specific chrome tab - AutoHotkey Community - Google Chrome

You could include the class like you have if you'd like, so it would be:
How to activate specific chrome tab - AutoHotkey Community - Google Chrome ahk_class Chrome_WidgetWin_1
User avatar
boiler
Posts: 16767
Joined: 21 Dec 2014, 02:44

Re: How to activate specific chrome tab

09 Apr 2021, 15:15

klk123 wrote:
09 Apr 2021, 13:54
Hi, i need your answer but I cant read it. can you send the answer again please?
thnak you!
I’m having a hard time believing this is a serious post, but I’ll entertain it just in case. Why would you not be able to read it, and how would my posting it again be any different?
jsong55
Posts: 219
Joined: 30 Mar 2021, 22:02

Re: How to activate specific chrome tab

10 Apr 2021, 20:49

Actually I wanted to solve this problem as well and I thought of 2 solutions

1. Cycle through the tabs using with
Loop
Send, ^{tab}
WinGet etc etc

Then if the win title matches what you want, act on it.

2. Simpler and easier method is to download a chrome extension, give it a shortcut key. And trigger it. Then send the webpage you want the extension to open.
Some extensions can do partial title match.

This in particular - https chrome.google.com /webstore/detail/quick-tabs/jnjfeinjfmenlddahdjdmgpbokiacbbb Broken Link for safety
Image Broken Link for safety
Spaceofficer
Posts: 1
Joined: 16 Jun 2021, 06:44

Re: How to activate specific chrome tab

16 Jun 2021, 07:06

jsong55 wrote:
10 Apr 2021, 20:49
Actually I wanted to solve this problem as well and I thought of 2 solutions

1. Cycle through the tabs using with
Loop
Send, ^{tab}
WinGet etc etc

Then if the win title matches what you want, act on it.
Hello,
Can you please share a script of this method? :)
Im new to AHK and Im looking for a way to do this exact thing.
I have googled and copy paste some suggestions, but they dont seem to work for me...
jsong55
Posts: 219
Joined: 30 Mar 2021, 22:02

Re: How to activate specific chrome tab

22 Jun 2021, 23:53

Spaceofficer wrote:
16 Jun 2021, 07:06
jsong55 wrote:
10 Apr 2021, 20:49
Actually I wanted to solve this problem as well and I thought of 2 solutions

1. Cycle through the tabs using with
Loop
Send, ^{tab}
WinGet etc etc

Then if the win title matches what you want, act on it.
Hello,
Can you please share a script of this method? :)
Im new to AHK and Im looking for a way to do this exact thing.
I have googled and copy paste some suggestions, but they dont seem to work for me...

Code: Select all

ActivateChromeTab(Tab_Text:="marcus")

ActivateChromeTab(Tab_Text:="hello world")

{
    WinActivate, ahk_exe Chrome.exe
    sleep,100
    Found:=0
    While !(Found)
    {
        SendInput {Ctrl Down}
        SendInput {tab} 
        SendInput {Ctrl Up}
        sleep,100
        WinGetTitle, WinT, ahk_exe Chrome.exe
        ToolTip,% WinT
        If InStr(WinT,"hello world")
            Found:=1
    }
    SetTimer, removetooltip, -3000
}
Esc::ExitApp

removetooltip:
ToolTip
Return
oldGuyTriesToTech
Posts: 1
Joined: 01 Jun 2022, 09:12

Re: How to activate specific chrome tab

01 Jun 2022, 09:41

I had a lot of trouble figuring out how to do this. It might not be the best way, but so far it works perfectly in chrome. I just took a snip of the favicon of the website and saved it to do an image search. Then it searches the tab area and clicks the matching tab. You could update it easily with an else statement that does a run of the website if the favicon is not found. I had to add the *50 prior to the image name in the image search because if the tab is already selected the background is highlighted and it wouldn't match. With this parameter entered, it allows for a variation of the pixels and the tab is selected either way. There is one thing that I haven't addressed which is if there are multiple tabs with the same favicon. I will deal with that when I get to it.

I'm new to this forum, so apologies if I've not done something right.

Code: Select all

^+o::
CoordMode, pixel, Screen
ImageSearch, FoundX, FoundY, 0, 0, 5116, 75, *50 GO.PNG
sleep, 500
FoundX := FoundX + 20
FoundY := FoundY + 15
If (ErrorLevel = 0)
{
    Click, %FoundX%, %FoundY% Left, 1
    Sleep, 500
}
return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: robforAHK2 and 114 guests