Send keys when notification window pops up?

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
osail
Posts: 5
Joined: 13 Jan 2022, 15:23

Send keys when notification window pops up?

Post by osail » 31 May 2023, 15:26

Trying to get this code to work but to no avail. Trying to automate pairing joy-cons but it doesn't seem to want to send the keys on the new notification.
The hotkeys work by themselves. But not with the watcher. win spy gives me a few ideas to get it working. But no luck. The Win+Shift+V is the standard hotkey to select a notification on Windows so I don't need a select window or mouse click sort of a thing.

Code: Select all

#Persistent
counter := 0

SetTimer, CheckForNotificationWindow, 1000 ; checks every second

CheckForNotificationWindow:
    counter += 1
    If counter > 30
    {
        SetTimer, CheckForNotificationWindow, Off ; disables the timer after 30 checks
    }
    else
    {
        IfWinExist, Add a device ahk_class Windows.UI.Core.CoreWindow ahk_exe ShellExperienceHost.exe
        {
            WinActivate
            Send, #+v ; Win+Shift+V
            Sleep, 100
            Send, {Enter}
            Sleep, 700
            Send, {Enter}
            Sleep, 700
            Send, {Enter}
            Sleep, 700
            Send, {Tab}
            Sleep, 700
            Send, {Enter}
            Sleep, 700
            Send, !{F4} ; Alt+F4
        }
    }
return
Help is appreciated thanks!
Attachments
image (2).png
windows notification
image (2).png (45.99 KiB) Viewed 330 times
image (4).png
Winspy results
image (4).png (26.53 KiB) Viewed 330 times

Return to “Ask for Help (v2)”