Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help opening certain Chrome tab
#3
Code:
Copy      Help
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();
    }
}


Messages In This Thread
Help opening certain Chrome tab - by eyescovered - 03-08-2024, 12:03 PM
RE: Help opening certain Chrome tab - by Gintaras - 03-08-2024, 01:32 PM
RE: Help opening certain Chrome tab - by Gintaras - 03-08-2024, 02:12 PM
RE: Help opening certain Chrome tab - by Davider - 03-12-2024, 11:56 AM
RE: Help opening certain Chrome tab - by Gintaras - 03-12-2024, 01:10 PM
RE: Help opening certain Chrome tab - by Davider - 03-12-2024, 11:50 PM
RE: Help opening certain Chrome tab - by Gintaras - 03-13-2024, 05:49 AM
RE: Help opening certain Chrome tab - by Davider - 03-13-2024, 06:24 AM
RE: Help opening certain Chrome tab - by Gintaras - 03-13-2024, 08:01 AM
RE: Help opening certain Chrome tab - by Davider - 03-13-2024, 09:13 AM
RE: Help opening certain Chrome tab - by Gintaras - 03-13-2024, 09:37 AM
RE: Help opening certain Chrome tab - by Davider - 03-14-2024, 05:55 AM
RE: Help opening certain Chrome tab - by Gintaras - 03-14-2024, 06:19 AM
RE: Help opening certain Chrome tab - by Davider - 03-23-2024, 10:51 PM
RE: Help opening certain Chrome tab - by birdywen - 03-24-2024, 01:07 AM
RE: Help opening certain Chrome tab - by Davider - 03-24-2024, 01:33 AM
RE: Help opening certain Chrome tab - by Gintaras - 03-24-2024, 07:25 AM
RE: Help opening certain Chrome tab - by Davider - 03-24-2024, 08:47 AM
RE: Help opening certain Chrome tab - by Davider - 03-25-2024, 11:54 PM
RE: Help opening certain Chrome tab - by Gintaras - 03-26-2024, 04:58 AM
RE: Help opening certain Chrome tab - by Davider - 03-31-2024, 11:52 AM
RE: Help opening certain Chrome tab - by Davider - 03-31-2024, 11:38 PM
RE: Help opening certain Chrome tab - by Gintaras - 04-01-2024, 04:35 AM
RE: Help opening certain Chrome tab - by Davider - 04-08-2024, 01:38 AM
RE: Help opening certain Chrome tab - by Gintaras - 04-09-2024, 05:21 AM
RE: Help opening certain Chrome tab - by Davider - 04-09-2024, 05:39 AM
RE: Help opening certain Chrome tab - by Gintaras - 04-09-2024, 05:45 AM
RE: Help opening certain Chrome tab - by Davider - 04-09-2024, 05:54 AM
RE: Help opening certain Chrome tab - by Davider - 04-13-2024, 07:05 AM
RE: Help opening certain Chrome tab - by Davider - 04-13-2024, 10:59 AM
RE: Help opening certain Chrome tab - by Davider - 04-14-2024, 11:47 PM
RE: Help opening certain Chrome tab - by Gintaras - 04-15-2024, 04:44 AM
RE: Help opening certain Chrome tab - by Davider - 04-15-2024, 05:32 AM
RE: Help opening certain Chrome tab - by Davider - 04-24-2024, 12:21 PM
RE: Help opening certain Chrome tab - by Gintaras - 04-24-2024, 01:02 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)