On windows system, i have Python/QT GUI running. Now on button push i need to activate minimised or not minimised google chrome in front of my application.
How to activate Google chrome and then switch to a very specific TAB by static title name or process id titles (using Python or other way)?
(For example activate the second tab)

Python: (does not work it is only working to open it)
import webbrowser
url = 'http://docs.python.org/'
chrome_path = 'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe %s'
webbrowser.get(chrome_path).open(url)
Ahk: fails
#d::
list := Acc_Get("Object", "4.23.1", 0, "ahk_class MozillaWindowClass")
;MsgBox % list.accChildCount-1
for each, tab in Acc_Children(list) {
MsgBox, % tab.accName(0)
tab.accDoDefaultAction(0)
}
Return
#c::WinActivate( "Calculator", "calc" )
#NoTrayIcon
#SingleInstance force
WinActivate( TheWindowTitle, TheProgramTitle )
{
SetTitleMatchMode,2
DetectHiddenWindows, Off
IfWinExist, %TheWindowTitle%
{
WinGet, winid, ID, %TheWindowTitle%
DllCall("SwitchToThisWindow", "UInt", winid, "UInt", 1)
}
Else
{
Run %TheProgramTitle%
}
Return
}
TRY TOO:
If ChromeHasTabNamed( "Activating Chrome Tab" )
MsgBox, Yes
Return
ChromeHasTabNamed( X ) {
SetTitleMatchMode, 2
WinGetTitle, title, - Chrome
While Not InStr( list, title "`n" ) {
list .= title "`n"
ControlSend,, ^{Tab}, - Chrome
Sleep, 50
WinGetTitle, title, - Chrome
}
Return, InStr( list, X ) ? True : False
}
TRY till DIE:
SetTitleMatchMode, 2
WinWaitActive - Google Chrome
ControlFocus, Chrome_RenderWidgetHostHWND1
Loop, 15
{
WinGetTitle, Title, A ;get active window title
if(InStr(Title, "Gmail")>0)
{
break ; Terminate the loop
}
Send ^{Tab}
Sleep, 50
}
return