I'd like to use Python and appscript to set a given Google tab as the foremost tab. I can acquire the tab thusly:
from appscript import *
chrome = app('Google Chrome')
tab_title = 'New York Times'
win_tabs = []
for win in chrome.windows.get():
win_tabs.append([])
tnames = map(lambda x: x.title(), win.tabs())
rel_t = [t for t in win.tabs() if tab_title in t.title()]
if len(rel_t):
rel_t = rel_t[0]
break
Now, I'd like to set that tab as the front-most window. Any ideas? I suspect I'd have to use something like
se = app('System Events')
And manage things from there, but I've no idea.