Advertisement
Lorenzo501

Cursor on App Group in Taskbar Opens Cycled Wnd of That Group.ahk

May 15th, 2024 (edited)
655
0
Never
2
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.     Can manage #HotIf expression like so:
  3.     static existingHotIfExpression := "MouseIsOverControl(`"ahk_class Shell_TrayWnd`", `"iS)\QWindows.UI.Composition.DesktopWindowContentBridge1\E|MSTaskSwWClass1|MSTaskListWClass`")"
  4.     HotIf(existingHotIfExpression), Hotkey("~*LButton", OpenCycledGroupWnd, "On") ; E.g. when you're disabling all ~*LButton hotkeys and need to turn this hotkey back on immediately
  5.  
  6.     Can also be done in regedit by right-clicking Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced and selecting New > DWORD (32-bit) Value.
  7.     You’ll see that the new entry will appear on the right side, and you should name it LastActiveClick. Then, double-click this entry you just added and change Value data from 0 to 1.
  8.     Click on OK to close that dialog box and restart your computer for the changes to take effect
  9.  */
  10. #Requires AutoHotkey 2.0
  11. #NoTrayIcon
  12. A_KeyDelay := -1 ; For Send b/c it reverts to the Event SendMode when another AHK script installs a low-level keyboard hook
  13.  
  14. ; https://www.autohotkey.com/docs/v2/misc/RegEx-QuickRef.htm (Regular Expressions [RegEx] - Quick Reference)
  15. ; ClassNN argument consists of three classes seperated by the | (OR) symbol, the first two for W11 and the third one for W10 (can be seen by using WinSpy++ on the app section in taskbar)
  16. #HotIf MouseIsOverControl("ahk_class Shell_TrayWnd", "iS)\QWindows.UI.Composition.DesktopWindowContentBridge1\E|MSTaskSwWClass1|MSTaskListWClass")
  17. ~*LButton::OpenCycledGroupWnd(*) => (Send("{Blind+!#}{Ctrl down}"), KeyWait("LButton"), Send("{Blind+!#}{Ctrl up}"))
  18.  
  19. MouseIsOverControl(winTitle, classNN)
  20. {
  21.     try return (MouseGetPos(,, &winId, &control), WinExist(winTitle " ahk_id " winId) && control ~= classNN)
  22.     return false
  23. }
Advertisement
Comments
  • Lorenzo501
    13 days
    # text 0.38 KB | 0 0
    1. I wonder if it can be improved, making it actually open the latest active wnd
    2. because Ctrl+Click merely cycles through windows of a specific app, it doesn't care which one was active last
    3. the only way I can think of is hooking the foreground event, temporarily making the wnd invisible
    4. and then checking if it's the latest active wnd, if not then cycle through until it's the right one
  • Lorenzo501
    13 days
    # text 0.10 KB | 0 0
    1. I heard from Nikola that it opens the latest active wnd on W11 all the time, so must be a W10 issue
Add Comment
Please, Sign In to add comment
Advertisement