MsEdge Window Switcher Problem Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
kerry369
Posts: 1
Joined: 24 Feb 2020, 02:48

MsEdge Window Switcher Problem

13 May 2021, 00:24

Hello,

I tried creating a window switcher for Microsoft Edge after repurposing the code for firefox/chrome found here:
https://github.com/TaranVH/2nd-keyboard/blob/9ee39aaccf9c58df9c4a7c19eb7d12ab5223872c/Almost_All_Windows_Functions.ahk#L570

My current code is as follows:

Code: Select all

; Application Switcher
;Switch MS Edge and cycle through its windows
SetTitleMatchMode, 2
F17::
Process, Exist, msedge.exe    
    If errorlevel = 0
        Run, msedge.exe
    else
        GroupAdd, selectmsedges, Microsoft Edge ahk_exe msedge.exe
    if WinActive("Microsoft Edge ahk_exe msedge.exe")
        GroupActivate, selectmsedges, r
    else
        WinActivate, Microsoft Edge ahk_exe msedge.exe
Return

F16::
Process, Exist, msedge.exe    
    If errorlevel = 0
        Run, msedge.exe
    else
        GroupAdd, allmsedges, ahk_exe msedge.exe
    if WinActive("ahk_exe msedge.exe")
        GroupActivate, allmsedges, r
    else
        WinActivate, ahk_exe msedge.exe
Return
Currently what F16 does is this:
If Microsoft Edge is not open, open it;
If Microsoft Edge is not active, make it active;
If Microsoft Edge is active, switch to a different Microsoft edge window

This does pretty much what I want. However, my problem is that I have used the "Install this site as an app" feature of Microsoft Edge, which creates a new window of a specific site and makes it as if it were an "independent app". This results in F16 cycling through those windows as well, which I do not want (I have tried fixing that problem with the code for F17).
Here is an example of an "independent app" window with Google Calendar:
image.png
image.png (61.86 KiB) Viewed 698 times
In contrast, a "normal" Microsoft Edge window looks like this:
image.png
image.png (62.33 KiB) Viewed 698 times
My intention is to have F17 only cycle through the "normal" Microsoft Edge windows. I have noticed that the "normal" windows always have a window title ending in "Microsoft Edge", so I have tried to distinguish them in my F17 function. But unfortunately, when I press F17, it seems to do nothing. Here are the script lines executed when I press F17:
image.png
image.png (8.04 KiB) Viewed 698 times
Thanks in advance for your help!
nutnutwin
Posts: 76
Joined: 28 Aug 2019, 07:25

Re: MsEdge Window Switcher Problem

13 May 2021, 02:02

The very reason I quit using these app as Browser Window...
aifritz
Posts: 301
Joined: 29 Jul 2018, 11:30
Location: Germany

Re: MsEdge Window Switcher Problem  Topic is solved

13 May 2021, 04:42

Wintitle for Microsoft Edge is looking a bit strange, cause the space between seems not to be the normal asc 32 char.
Perhaps this one is a workaround

Code: Select all

F17::
SetTitleMatchMode, regEx
		    
Process, Exist, msedge.exe    
If (errorlevel = 0)
    Run, msedge.exe
else    
    GroupAdd, allmsedges, Microsoft.*Edge
    
if WinActive("Microsoft.*Edge")
    GroupActivate, allmsedges, r
else
    WinActivate, Microsoft.*Edge
Return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: doodles333 and 376 guests