Exit

How to trap tray notifications in Windows 10 ?

3 posts in this topic

#1 ·  Posted (edited)

I want to trap a tray notification from Bluestacks/WhatsApp.

Zwischenablage01.thumb.jpg.9a4cb2e817734Zwischenablage02.jpg.81e7b04d29690bd1651

Here is my code

OnAutoItExitRegister("_Exit")
Func _Exit()
    If IsDeclared("@exitCode") Then MsgBox(262144, Default, "Exit", 3)
    Exit
EndFunc   ;==>_Exit
If Not HotKeySet("{ESC}", "_Exit") Then Exit MsgBox(16 + 262144, Default, "Script cancelled due to HotKey ESC already defined. ", 5)
MsgBox(262144, Default, "Start", 1)
While Sleep(1000)
    Beep(500, 100)
    ; next line has german string "Neue Benachrichtigung". change it if not running german version of windows
    If WinExists("[class:Windows.UI.Core.CoreWindow;title:Neue Benachrichtigung]") Then ExitLoop
WEnd
Beep(1000, 1000)
MsgBox(262144, Default, "Window found", 0)

The code does not show the "Window found" message even when the tray notify message appears.

When I omit the ";title:Neue Benachrichtigung" the "found" message appears at once even when there is no notification window.

Do you know of another method to read the notification Windows of other applications?

 

 

Zwischenablage02.jpg

Edited by Exit

My UDFs, Abbrevs and Snippets
If you like my post, just click the like button :) 

Share this post


Link to post
Share on other sites



I think You can do this if just want to know it exist a notification of bluestack.

 

#include <GUIConstantsEx.au3>
#include <WinAPIEx.au3>

Global $BlueStackPID = ProcessExists("Bluestacks.exe") ;the corrcet process name I dont know what it is. :S

Example()

Func Example()
    Local $hGUI = GUICreate('An(other) example by guinness - 2013', Default, Default)
    GUISetState(@SW_SHOW, $hGUI)

    GUIRegisterMsg(_WinAPI_RegisterWindowMessage('SHELLHOOK'), 'WM_SHELLHOOK')
    _WinAPI_RegisterShellHookWindow($hGUI)

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd

    _WinAPI_DeregisterShellHookWindow($hGUI)
    GUIDelete($hGUI)
EndFunc   ;==>Example


Func WM_SHELLHOOK($hWnd, $iMsg, $wParam, $lParam)
    #forceref $iMsg
    Local $sTitle = WinGetTitle($lParam)
    Local $iPID=0
     $iPID = _WinAPI_GetWindowThreadProcessId($hWnd, $iPID)
    If $wParam = $HSHELL_REDRAW And $sTitle = "Notificación nueva" and $iPID = $BlueStackPID Then
        ConsoleWrite("BlueStack Notification!!!" & @CRLF)
    EndIf

EndFunc   ;==>WM_SHELLHOOK

 

If you want to check the text "whatsapp"   you must combine with  this.

 

 

Saludos

1 person likes this

Share this post


Link to post
Share on other sites

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