Jump to content

Recommended Posts

Posted

I need to read windows push notifications, but I'm at a loss.

I've captured them with this code, however I cannot find any controls inside the window to read.

#include <APISysConstants.au3>
#include <WinAPISysWin.au3>

Global $gui = GUICreate( '' )

GUIRegisterMsg( _WinAPI_RegisterWindowMessage( "SHELLHOOK" ), "WM_SHELLHOOK" )
_WinAPI_RegisterShellHookWindow( $gui )
OnAutoItExitRegister('OnAutoItExit')

While 1
    Sleep( 10 )
WEnd

Func WM_SHELLHOOK( $hWnd, $iMsg, $wParam, $lParam )
    #forceref $iMsg

     Switch $hWnd
        Case $gui
            Local $title = WinGetTitle( $lParam )
            Switch $wParam
                Case $HSHELL_REDRAW
                    If IsString( $title ) Then
                        If $title == "New notification" Then
                            Local $data = "" ; ??
                            ConsoleWrite( "Notification: " & $data & @CRLF )
                        EndIf
                    EndIf
            EndSwitch
    EndSwitch

EndFunc

Func OnAutoItExit()
    _WinAPI_DeregisterShellHookWindow($gui)
EndFunc

 

Posted

Are you using the correct version of CUIAutomation2.au3 dated 2018-01-12 from the Includes folder?

Posted
4 minutes ago, LarsJ said:

Are you using the correct version of CUIAutomation2.au3 dated 2018-01-12 from the Includes folder?

Yes, I found out it was because the notification window only lasts 5 seconds and the program requires the window to remain open to make code for it.  Anyways, I increated the notification time to 5 mins so the window stays open, then tried to create code.  Everything I created from UI Automation was unable to run with script errors, tons of them.  Can't seem to get it to work following the guide on your post.

  • 2 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...