Sign in to follow this  
Followers 0
Leanna

How to activate a inactive tab in Chrome

10 posts in this topic

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?

Share this post


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.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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.

Share this post


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?

Share this post


Link to post
Share on other sites

With the FF.au3 UDF, in the Example Scripts forum, this would be possible. With Firefox though. I don't think there is a UDF for Chrome that would make this possible.


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

Share this post


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.

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

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...

Share this post


Link to post
Share on other sites

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

Share this post


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
Sign in to follow this  
Followers 0