我想使用 Python 和 appscript 将给定的 Google 标签设置为最重要的标签。我可以这样获得标签:
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
现在,我想将该选项卡设置为最前面的窗口。有任何想法吗?我怀疑我必须使用类似的东西
se = app('System Events')
并从那里管理事情,但我不知道。