Jump to content

How to activate a inactive tab in Chrome


Recommended Posts

Hello,

Could you help me, how can I activate a Chrome tab?

The tab is not active among other Chrome tabs.

WinActivate("[TITLE:Yahoo! - Google Chrome]")

This code works only if "Yahoo! - Google Chrome" is an active tab in Chrome, in this case it works even if chrome is minimized or inactive.The code doesn't work if another tab is active for ex. Google tab.

Could you help me to solve it?

Link to post
Share on other sites

I've tested it.

Opt("WinTitleMatchMode",2) 
WinActivate("[TITLE:Yahoo! - Google Chrome]")

Works the same as

WinActivate("[TITLE:Yahoo! - Google Chrome]")

i.e. If chrome is inactive and the tab Yahoo is active - it activates Chrome,

but if Chrome is inactive and Yahoo tab is inactive - nothing happens.

Is there something else for solution?

Thank you for trying to help.

Link to post
Share on other sites

Both of those snippets should work the same, Leanna, the WinActivate line is the same in both of them. Try JohnOne's post again. Basically, with WinTitleMatchMode - 2, and [TITLE:Google Chrome], Chrome will be activated no matter which tab is current. That is what you're after, right? See the help file for more info about WinTitleMatchMode.

Edited by somdcomputerguy

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Link to post
Share on other sites

Yes, this works, it opens chrome. But what I need is to open a preopened tab with the Name Yahoo!. And the Yahoo tab may be not active.

For example I have several tabs opened in Chrome: Google Yahoo and Amazon. Google tab is active. But i need to activate Yahoo tab.

Is that possible?

Link to post
Share on other sites

Just send a keystroke, if you already know the position of the opened tab. Try pressing CTRL+1, then CTRL+2, then 3 and 4 and see what happens to the tabs. You could then possibly set wintitlematchmode to 0 again to check whether it is the correct tab open. It is a dodgy work-around, but it could work.

Link to post
Share on other sites
  • 3 years later...
Func Quora ()
    WinActivate ( " - Google Chrome" )
    _SendEx ( "^l" )
    _SendEx ("tab ")
    Sleep ( 50 )
    _SendEx ( "quora")
    Sleep ( 50 )
    _SendEx ("{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}")
    Sleep ( 50 )
    _SendEx ( "{ENTER}" )
    ;FindTab ()
EndFunc

Requires the TabTab Search Chrome Extension

Edited by glumbler
Found a better way...
Link to post
Share on other sites
  • 1 month later...

I can't believe there isn't a function for this, I was looking for one. Despite this being a really old thread, it showed up near the top of my search, so I'll put my solution here for posterity. A simple (6 lines) "while" loop will do the job:

WinActivate("[TITLE:Google Chrome]")

$currTab = WinGetTitle("[ACTIVE]")


while StringInStr($currTab, "Yahoo!") = 0
Send('^{TAB}')
$currTab = WinGetTitle("[ACTIVE]")
WEnd

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...