Chrome.ActivateTab("New Tab");
1.s();
Chrome.ActivateTab("Help opening*");
1.s();
Chrome.ActivateTab("Class elm*");
//var w = wnd.find(0, cn: "Chrome_WidgetWin_1");
//Chrome.ActivateTab(w, "ChatGPT");
static class Chrome {
/// <summary>
/// Finds Chrome window that contains the specified tab and activates the tab.
/// </summary>
/// <param name="name">Tab name. Format: wildcard expression.</param>
/// <exception cref="Exception">Exceptions of <see cref="wnd.find(Seconds, string, string, WOwner, WFlags, Func{wnd, bool}, WContains)"/> and <see cref="elmFinder.Find()"/>.</exception>
/// <param name="activateWindow">Activete the Chrome window. Default true.</param>
public static void ActivateTab(string name, bool activateWindow = true) {
wildex wname = name;
regexp rx = new(@"^(.+) - [^-]+ - [^-]+$");
elmFinder ef = new("PAGETAB", prop: "notin=DOCUMENT,TOOLBAR", also: o => o.Name is string s && wname.Match(rx.Replace(s, "$1")));
var w = wnd.find(1, "*Google Chrome", "Chrome_WidgetWin_1", contains: ef);
if (activateWindow) w.Activate();
ef.Result.Invoke();
}
/// <summary>
/// Finds and activates a Chrome tab in the specified Chrome window.
/// </summary>
/// <param name="wChrome">Chrome window.</param>
/// <param name="name">Tab name. Format: wildcard expression.</param>
/// <exception cref="Exception">Exceptions of <see cref="elmFinder.Find(Seconds)"/>.</exception>
public static void ActivateTab(wnd wChrome, string name) {
wildex wname = name;
regexp rx = new(@"^(.+) - [^-]+ - [^-]+$");
var e = wChrome.Elm["PAGETAB", prop: "notin=DOCUMENT,TOOLBAR", also: o => o.Name is string s && wname.Match(rx.Replace(s, "$1"))].Find(1);
e.Invoke();
}
}
Help opening certain Chrome tab
|
|
« Next Oldest | Next Newest »
|
Users browsing this thread: 1 Guest(s)