Jump to content

Recommended Posts

Posted (edited)

Oh this is nice. How did you get them to persist like that?

EDIT: I've only spent about 10 minutes playing around with this, but I love it. AutoIt has really needed this because there hasn't been a solution yet for Windows 11 that has been able to have the toasts persist in the notification center like this.

Fantastic work. I look forward to watching this progress over time. I definitely can make great use of this.

Edited by WildByDesign
Posted
20 minutes ago, WildByDesign said:

Oh this is nice. How did you get them to persist like that?

Thank you :D My guess is the combination of attributes used, but haven't spend much time on the XML, after i got it somewhat usable :P

22 minutes ago, WildByDesign said:

EDIT: I've only spent about 10 minutes playing around with this, but I love it. AutoIt has really needed this because there hasn't been a solution yet for Windows 11 that has been able to have the toasts persist in the notification center like this.

Glad to hear! :D Yeah in general AutoIt has been missing proper native toasts since the windows 8 overhaul, as far as i know ;)

24 minutes ago, WildByDesign said:

Fantastic work. I look forward to watching this progress over time. I definitely can make great use of this.

Yeah it's a little rough around the edges currently, but i am working towards providing a good implementation little by little :D
Happy to hear it will be used :D

Posted

Hi @genius257Very cool,
I'm not familiar with this stuff, but it looks interesting.
You've done a great job implementing it in AutoIt!
I tried creating some simple test toasts in XML, but not all the tags work correctly at the moment (for example, the <image> tag doesn't display the image if the "src=" parameter is a URL...). Furthermore, it's mandatory to specify the activationType="background" parameter in the initial <toast...> tag...
To generate my test toasts in XML, I installed this app (which also has ready-made templates): https://apps.microsoft.com/detail/9nblggh5xsl1
then, to insert the generated XML code into your example listing in AutoIt, I copy the generated code to the clipboard (select the listing and press Ctrl-C), and immediately run this little script (F5 in SciTE), which adapts it and puts it back in the clipboard. I then paste it into the AutoIt listing.

Local $sVarName = "$sToast"
Local $aStr = StringSplit(ClipGet(), @CRLF, 1) ;  get the clipboard content

Local $sListing ; = "Func " & $sFuntionName & "()" & @CRLF
$sListing &= 'Local ' & $sVarName & ' = ""' & @CRLF
For $i = 1 To $aStr[0]
    $sListing &= $sVarName & ' &= "' & StringReplace($aStr[$i], '"', '""') & '" ' & @CRLF
Next

ClipPut($sListing)
ConsoleWrite($sListing)

This is an example of output (which I later modified a bit) to insert into the example script.

Local $sToast = ""
$sToast &= "<toast activationType=""background"" launch=""action=viewAlarm&amp;alarmId=3"" scenario=""alarm"">"
$sToast &= ""
$sToast &= "  <visual>"
$sToast &= "    <binding template=""ToastGeneric"">"
$sToast &= "      <text>Time to wake up!</text>"
$sToast &= "      <text>To prove you're awake, select which of the following fruits is yellow...</text>"
$sToast &= '      <image placement="appLogoOverride" src="file://' & @TempDir & '\e21cd29c9fb51c3a5b82f009ec33fc997d2edd1ece931e8568f37e205c445778.jpeg" hint-crop="circle"/>'
$sToast &= "    </binding>"
$sToast &= "  </visual>"
$sToast &= ""
$sToast &= "  <actions>"
$sToast &= ""
$sToast &= "    <input id=""answer"" type=""selection"" defaultInput=""wrongDefault"">"
$sToast &= "      <selection id=""wrong"" content=""Orange""/>"
$sToast &= "      <selection id=""wrongDefault"" content=""Blueberry""/>"
$sToast &= "      <selection id=""right"" content=""Banana""/>"
$sToast &= "      <selection id=""wrong"" content=""Avacado""/>"
$sToast &= "      <selection id=""wrong"" content=""Cherry""/>"
$sToast &= "    </input>"
$sToast &= ""
$sToast &= "    <action"
$sToast &= "      activationType=""system"""
$sToast &= "      arguments=""snooze"""
$sToast &= "      content=""""/>"
$sToast &= ""
$sToast &= "    <action"
$sToast &= "      activationType=""background"""
$sToast &= "      arguments=""dismiss"""
$sToast &= "      content=""Dismiss""/>"
$sToast &= ""
$sToast &= "  </actions>"
$sToast &= ' <audio src=''ms-winsoundevent:Notification.Looping.Alarm'' loop=''false''/>'
$sToast &= "</toast>"


.. I hope you can implement support for events too...


Bye and thanks! :)

P.S.
There was a notification "emulator" at this link:: Notifications UDF - Desktop notifications 1.2 (updated Mai 1st) - AutoIt Example Scripts - AutoIt Forums

 

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Posted
6 hours ago, genius257 said:

Event on toast interaction now works! 🎉

I was able to test this new event functionality this morning and it works great. Excellent job!

Without a doubt, this is the most fully featured toast notification UDF for AutoIt specifically for utilizing native toast functionality. There are some other UDFs which create their own toast-like notifications. But using built-in Windows functionality is generally the best way to go.

Your UDF already does everything that I personally would ever need as far as toast notifications go.

One of the best toast notification apps that I've ever used on Windows 11 is actually from KDE, of all things. Snoretoast (https://github.com/KDE/snoretoast). But I didn't like the idea of having to drop yet another binary on disk for my users. So I will likely switch those apps over to your UDF and keep it all AutoIt.

By the way, you can always browse their source code (C++) to see if there is anything that they do that might be beneficial for your UDF. I don't understand some of the more complex parts of toast notification functionality, so I'm not even sure if they have anything extra or not.

Cheers (or toast!) 🍷

Posted (edited)

Hi @Gianni,
Sorry for the late reply.
First of all thank you for the nice words :).
 

On 9/26/2025 at 11:33 PM, Gianni said:

the <image> tag doesn't display the image if the "src=" parameter is a URL...

Yes i noticed that, that's why my demo downloads an image instead. I'm not currently sure why it does not work. 🤷‍♂️
I seem to remember some documentation mentioning requirements like maximum response time and file size, but i cannot find that currently.

 

On 9/26/2025 at 11:33 PM, Gianni said:

it's mandatory to specify the activationType="background" parameter in the initial <toast...> tag...

It seems to be the case, when the app is not registered with the system. After adding the registry and registering the COM objects, activationType foreground also works.
Again, not sure why, currently.
 

On 9/26/2025 at 11:33 PM, Gianni said:

I installed this app (which also has ready-made templates): https://apps.microsoft.com/detail/9nblggh5xsl1

This is a very cool tool for crafting toast UI, thanks :D

Edit: I can see the tool might be available as open source on GitHub, so maybe I'll make an AutoIt version at some point, for fun :P
 

On 9/26/2025 at 11:33 PM, Gianni said:

Ah, thank you :)

Edited by genius257
Posted (edited)

Hi @WildByDesign,
Thank you for the feedback and nice words :)
I'm glad to hear it will be put to good use :D

Thanks for the information about KDE/snoretoast, i will differently look at the codebase later, and see if there is anything I'm missing ;)

Edit: And thank you for the star on GitHub :D

Edited by genius257
  • genius257 changed the title to Native win8+ toast notifications
Posted

Hi @genius257, and thanks for your progress :)
From some tests I'm running, I'd expect the callback function to return the values of the fields in the "toast" in the $data parameter.
Using the following script, I see that the parameter ($data) contains a pointer, but what does it point to, and how can I read the data it points to?
bye and thanks

#include "./src/toast.au3"
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <InetConstants.au3>

#include <WinApiReg.au3>
#include <WinApiIcons.au3>
#include <GDIPlus.au3>
#include <WinAPIConv.au3>

If Not FileExists(@TempDir & "\e25dbe211ddfb027fcb8271d833159fc.png") Then
    _GDIPlus_Startup()
    $thIcons = DllStructCreate("HWND")
    $x = _WinAPI_ExtractIconEx(@AutoItExe, 0, 0, $thIcons, 1)
    ConsoleWrite($x & @CRLF)
    $hBitmap = _GDIPlus_BitmapCreateFromHICON(DllStructGetData($thIcons, 1))
    _GDIPlus_ImageSaveToFileEx($hBitmap, @TempDir & "\e25dbe211ddfb027fcb8271d833159fc.png", _GDIPlus_EncodersGetCLSID("PNG"))
    _GDIPlus_BitmapDispose($hBitmap)
    ConsoleWrite(@error & @CRLF)
    _GDIPlus_Shutdown()
    _WinAPI_DestroyIcon(DllStructGetData($thIcons, 1))
EndIf

Global Const $sAppName = @ScriptName
Global $tCLSID = _Toast_CoCreateGuid()
Global $sGUID = _WinAPI_StringFromGUID($tCLSID)
ConsoleWrite("app CLSID: " & $sGUID & @CRLF)

_Toast_Initialize($sAppName, $tCLSID, OnToastActivation, "AutoIt Toast Example", @TempDir & "\e25dbe211ddfb027fcb8271d833159fc.png")

Opt("GuiOnEventMode", 1)

Global $hWnd = GUICreate("Toast example", 700, 320)
GUISetOnEvent($GUI_EVENT_CLOSE, "GUI_CLOSE")

Global $hButton01 = GUICtrlCreateButton("From template", 10, 10, 200, 120)
GUICtrlSetOnEvent(-1, "ToastFromTemplateExample")

Global $hButton02 = GUICtrlCreateButton("From XML string", 10, 140, 200, 120)
GUICtrlSetOnEvent(-1, "ToastFromXmlString")

Global $hRich = _GUICtrlRichEdit_Create($hWnd, "", 220, 10, 470, 300)

GUISetState()

While 1
    Sleep(10)
WEnd

Func ToastFromTemplateExample()
    Local $oXml = _Toast_CreateToastTemplateXmlDocument()

    Local $pToast = _Toast_CreateToastNotificationFromXmlObject($oXml)

    _Toast_Show($pToast)
EndFunc   ;==>ToastFromTemplateExample

Func DownloadImage()
    If FileExists(@TempDir & "\e21cd29c9fb51c3a5b82f009ec33fc997d2edd1ece931e8568f37e205c445778.jpeg") Then Return
    _GUICtrlRichEdit_AppendText($hRich, "Trying to download avatar image from gravatar..." & @CRLF)
    Local $iBytes = InetGet("https://gravatar.com/avatar/e21cd29c9fb51c3a5b82f009ec33fc997d2edd1ece931e8568f37e205c445778", @TempDir & "\e21cd29c9fb51c3a5b82f009ec33fc997d2edd1ece931e8568f37e205c445778.jpeg", $INET_FORCEBYPASS)
    Local $error = @error
    If @error <> 0 Then
        _GUICtrlRichEdit_AppendText($hRich, "Failed to download image" & @CRLF)
        Return
    EndIf
    _GUICtrlRichEdit_AppendText($hRich, "Done! " & $iBytes & " bytes downloaded" & @CRLF)
EndFunc   ;==>DownloadImage

Func ToastFromXmlString()
    DownloadImage()
    ; https://learn.microsoft.com/en-us/windows/apps/design/shell/tiles-and-notifications/adaptive-interactive-toasts?tabs=xml
    Local $sToast = ""
    $sToast &= "<toast activationType=""foreground"" launch=""action=viewAlarm&amp;alarmId=3"" scenario=""alarm"">" ; action=mainContent;alarmId=3
    $sToast &= ""
    $sToast &= "  <visual>"
    $sToast &= "    <binding template=""ToastGeneric"">"
    $sToast &= "      <text>Time to wake up!</text>"
    $sToast &= "      <text>To prove you're awake, select which of the following fruits is yellow...</text>"
    $sToast &= '      <image placement="appLogoOverride" src="file://' & @TempDir & '\e21cd29c9fb51c3a5b82f009ec33fc997d2edd1ece931e8568f37e205c445778.jpeg" hint-crop="circle"/>'
    $sToast &= "    </binding>"
    $sToast &= "  </visual>"
    $sToast &= ""
    $sToast &= "  <actions>"
    $sToast &= ""
    $sToast &= "    <input id=""answer"" type=""selection"" defaultInput=""wrongDefault"">"
    $sToast &= "      <selection id=""wrong"" content=""Orange""/>"
    $sToast &= "      <selection id=""wrongDefault"" content=""Blueberry""/>"
    $sToast &= "      <selection id=""right"" content=""Banana""/>"
    $sToast &= "      <selection id=""wrong"" content=""Avacado""/>"
    $sToast &= "      <selection id=""wrong"" content=""Cherry""/>"
    $sToast &= "    </input>"
    $sToast &= ""
    $sToast &= "    <action"
    $sToast &= "      activationType=""background"""
    $sToast &= "      arguments=""snooze"""
    $sToast &= "      content=""snooze""/>"
    $sToast &= ""
    $sToast &= "    <action"
    $sToast &= "      activationType=""background"""
    $sToast &= "      arguments=""dismiss"""
    $sToast &= "      content=""Dismiss""/>"
    $sToast &= ""
    $sToast &= "  </actions>"
    $sToast &= ' <audio src=''ms-winsoundevent:Notification.Looping.Alarm'' loop=''false''/>'
    $sToast &= "</toast>"
    ;#ce
    Local $pToast = _Toast_CreateToastNotificationFromXmlString($sToast)

    If @error <> 0 Then
        _GUICtrlRichEdit_AppendText($hRich, _WinAPI_GetErrorMessage(@error))
        Return
    EndIf

    _Toast_Show($pToast)
    _GUICtrlRichEdit_AppendText($hRich, $pToast & @TAB & "VarGetType: " & VarGetType($pToast) & @CRLF)
EndFunc   ;==>ToastFromXmlString

; https://learn.microsoft.com/en-us/windows/win32/api/notificationactivationcallback/nf-notificationactivationcallback-inotificationactivationcallback-activate
Func OnToastActivation($pSelf, $appUserModelId, $invokedArgs, $data, $count)
    _GUICtrlRichEdit_AppendText($hRich, _
            "Toast activated!" & @CRLF _
             & "    " & "appUserModelId: " & $appUserModelId & @TAB & "VarGetType: " & VarGetType($appUserModelId) & @CRLF _
             & "    " & "invokedArgs: " & $invokedArgs & @TAB & "VarGetType: " & VarGetType($invokedArgs) & @CRLF _
             & "    " & "$data: " & $data & @TAB & "VarGetType: " & VarGetType($data) & @TAB & DllStructGetData($data, 1) & @CRLF _ ; ??? also _WinAPI_GetString ... no good as well
             & "    " & "$count: " & $count & @TAB & "VarGetType: " & VarGetType($count) & @CRLF _
            )

    Return $_Toast_S_OK
EndFunc   ;==>OnToastActivation

Func GUI_CLOSE()
    Exit
EndFunc   ;==>GUI_CLOSE

 

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Posted

Hi @Gianni,

Thanks you, glad to see the interest in the code :D

5 hours ago, Gianni said:

From some tests I'm running, I'd expect the callback function to return the values of the fields in the "toast" in the $data parameter.
Using the following script, I see that the parameter ($data) contains a pointer, but what does it point to, and how can I read the data it points to?
bye and thanks

Yes, the $data variable contains a pointer to a array of NOTIFICATION_USER_INPUT_DATA elements. The length of the array is given via the $count variable.

Something like this should do it (not tested yet)

$pData = $data
For $i = 1 To $count
    $tData = DllStructCreate('PTR Key;PTR Value;', $pData)
    $key = _WinAPI_GetString($tData.Key)
    $value = _WinAPI_GetString($tData.Value)
    ConsoleWrite(StringFormat('"%s"="%s"\n', $key, $value))
    $pData += DllStructGetSize($tData)
Next

I think I'll update the example with inputs to demonstrate later, and I'll also add a helper function to convert the data array into a Map :)

I'll update the post later, when i have time to test the code, if something does not work ;) 

Posted

Hi @genius257
Your input data reader works great!
I added several inputs and buttons for a quick, rough test, and the values entered into the "toast" are returned to the callback and parsed correctly by your function.
It appears that a notification toast doesn't allow more than 5 inputs; each selector input can't contain more than 5 options, and buttons can't exceed 5. Text inputs allow about 2,000 characters.
But these limitations are due to the inherent features of Microsoft notification toasts, not your code.
... these toasts are funny...
Bye and thanks again!

cheers

#include "./src/toast.au3"
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <InetConstants.au3>

#include <WinApiReg.au3>
#include <WinApiIcons.au3>
#include <GDIPlus.au3>
#include <WinAPIConv.au3>

If Not FileExists(@TempDir & "\e25dbe211ddfb027fcb8271d833159fc.png") Then
    _GDIPlus_Startup()
    $thIcons = DllStructCreate("HWND")
    $x = _WinAPI_ExtractIconEx(@AutoItExe, 0, 0, $thIcons, 1)
    ConsoleWrite($x & @CRLF)
    $hBitmap = _GDIPlus_BitmapCreateFromHICON(DllStructGetData($thIcons, 1))
    _GDIPlus_ImageSaveToFileEx($hBitmap, @TempDir & "\e25dbe211ddfb027fcb8271d833159fc.png", _GDIPlus_EncodersGetCLSID("PNG"))
    _GDIPlus_BitmapDispose($hBitmap)
    ConsoleWrite(@error & @CRLF)
    _GDIPlus_Shutdown()
    _WinAPI_DestroyIcon(DllStructGetData($thIcons, 1))
EndIf

Global Const $sAppName = @ScriptName
Global $tCLSID = _Toast_CoCreateGuid()
Global $sGUID = _WinAPI_StringFromGUID($tCLSID)
ConsoleWrite("app CLSID: " & $sGUID & @CRLF)

_Toast_Initialize($sAppName, $tCLSID, OnToastActivation, "AutoIt Toast Example", @TempDir & "\e25dbe211ddfb027fcb8271d833159fc.png")

Opt("GuiOnEventMode", 1)

Global $hWnd = GUICreate("Toast example", 700, 320)
GUISetOnEvent($GUI_EVENT_CLOSE, "GUI_CLOSE")

Global $hButton01 = GUICtrlCreateButton("From template", 10, 10, 200, 120)
GUICtrlSetOnEvent(-1, "ToastFromTemplateExample")

Global $hButton02 = GUICtrlCreateButton("From XML string", 10, 140, 200, 120)
GUICtrlSetOnEvent(-1, "ToastFromXmlString")

Global $hRich = _GUICtrlRichEdit_Create($hWnd, "", 220, 10, 470, 300)

GUISetState()

While 1
    Sleep(10)
WEnd

Func ToastFromTemplateExample()
    Local $oXml = _Toast_CreateToastTemplateXmlDocument()

    Local $pToast = _Toast_CreateToastNotificationFromXmlObject($oXml)

    _Toast_Show($pToast)
EndFunc   ;==>ToastFromTemplateExample

Func DownloadImage()
    If FileExists(@TempDir & "\e21cd29c9fb51c3a5b82f009ec33fc997d2edd1ece931e8568f37e205c445778.jpeg") Then Return
    _GUICtrlRichEdit_AppendText($hRich, "Trying to download avatar image from gravatar..." & @CRLF)
    Local $iBytes = InetGet("https://gravatar.com/avatar/e21cd29c9fb51c3a5b82f009ec33fc997d2edd1ece931e8568f37e205c445778", @TempDir & "\e21cd29c9fb51c3a5b82f009ec33fc997d2edd1ece931e8568f37e205c445778.jpeg", $INET_FORCEBYPASS)
    Local $error = @error
    If @error <> 0 Then
        _GUICtrlRichEdit_AppendText($hRich, "Failed to download image" & @CRLF)
        Return
    EndIf
    _GUICtrlRichEdit_AppendText($hRich, "Done! " & $iBytes & " bytes downloaded" & @CRLF)
EndFunc   ;==>DownloadImage

Func ToastFromXmlString()
    DownloadImage()
    ; https://learn.microsoft.com/en-us/windows/apps/design/shell/tiles-and-notifications/adaptive-interactive-toasts?tabs=xml
    Local $sToast = ""
    $sToast &= "<toast activationType=""foreground"" launch=""action=viewAlarm&amp;alarmId=3"" scenario=""alarm"">" ; action=mainContent;alarmId=3
    $sToast &= ""
    $sToast &= "  <visual>"
    $sToast &= "    <binding template=""ToastGeneric"">"
    $sToast &= "      <text>Time to wake up!</text>"
    $sToast &= "      <text>To prove you're awake, select which of the following fruits is yellow...</text>"
    $sToast &= '      <image placement="appLogoOverride" src="file://' & @TempDir & '\e21cd29c9fb51c3a5b82f009ec33fc997d2edd1ece931e8568f37e205c445778.jpeg" hint-crop="circle"/>'
    $sToast &= "    </binding>"
    $sToast &= "  </visual>"
    $sToast &= ""
    $sToast &= "  <actions>"
    $sToast &= "<!-- #1 First input-->"
    $sToast &= "    <input id=""Options"" type=""selection"" defaultInput=""Selection1"">"
    $sToast &= "      <selection id=""Selection1"" content=""Option 1/5""/>"
    $sToast &= "      <selection id=""Selection2"" content=""Option 2/5""/>"
    $sToast &= "      <selection id=""Selection3"" content=""Option 3/5""/>"
    $sToast &= "      <selection id=""Selection4"" content=""Option 4/5""/>"
    $sToast &= "      <selection id=""Selection5"" content=""Option 5/5""/>"
    ; $sToast &= "      <selection id=""Selection6"" content=""Option 6/6""/>" ; No more than 5 options allowed
    $sToast &= "    </input>"

    $sToast &= "<!-- #2 Second input-->"
    $sToast &= "    <input id=""Poem"" type=""text"" placeHolderContent=""Please write a poem"" />"

    $sToast &= "<!-- #3 Third input-->"
    $sToast &= "    <input id=""Season"" type=""selection"" defaultInput=""Autumn"">"
    $sToast &= "      <selection id=""Spring"" content=""Spring""/>"
    $sToast &= "      <selection id=""Summer"" content=""Summer""/>"
    $sToast &= "      <selection id=""Autumn"" content=""Autumn""/>"
    $sToast &= "      <selection id=""Winter"" content=""Winter""/>"
    $sToast &= "    </input>"

    $sToast &= "<!-- #4 Fourth input-->"
    $sToast &= "    <input id=""Mood"" type=""selection"" defaultInput=""Love"">"
    $sToast &= "      <selection id=""Happy"" content=""I'm Happy 😀""/>"
    $sToast &= "      <selection id=""Sad"" content=""I'm Sad 😢""/>"
    $sToast &= "      <selection id=""Love"" content=""I'm in love ❤️""/>"
    $sToast &= "      <selection id=""Angry"" content=""I'm mad at the whole world 🖕""/>"
    $sToast &= "    </input>"

    $sToast &= "<!-- #5 Fifth input-->"
    $sToast &= "    <input id=""Gender"" type=""selection"" defaultInput=""Female"">"
    $sToast &= "      <selection id=""Male"" content=""I'm a man""/>"
    $sToast &= "      <selection id=""Female"" content=""I'm a woman""/>"
    $sToast &= "    </input>"
    #cs ; --- No more than 5 inputs allowed and no more than 5 entry ---
    $sToast &= "<!-- #6 Sixth input-->"
    $sToast &= "    <input id=""WeekDay"" type=""selection"" defaultInput=""Wednesday"">"
    $sToast &= "      <selection id=""Monday"" content=""Monday""/>"
    $sToast &= "      <selection id=""Tuesday"" content=""5 Sincronizza contatti""/>"
    $sToast &= "      <selection id=""Wednesday"" content=""Wednesday""/>"
    $sToast &= "      <selection id=""Thursday"" content=""Thursday""/>"
    $sToast &= "      <selection id=""Friday"" content=""Friday""/>"
    $sToast &= "      <selection id=""Saturday"" content=""Saturday""/>"
    $sToast &= "      <selection id=""Sunday"" content=""Sunday""/>"
    $sToast &= "    </input>"
    #ce ; --- No more than 5 inputs allowed and no more than 5 entry ---
    $sToast &= ""
    $sToast &= "    <!-- Button 1 -->"
    $sToast &= "    <action content=""Yes, I agree"""
    $sToast &= "            arguments=""action=Agree"""
    $sToast &= "            activationType=""background""/>"
    $sToast &= "    <!-- Button 2 -->"
    $sToast &= "    <action content=""No, I disagree"""
    $sToast &= "            arguments=""action=Disagree"""
    $sToast &= "            activationType=""background""/>"
    $sToast &= "    <!-- Button 3 -->"
    $sToast &= "    <action content=""Save data"""
    $sToast &= "            arguments=""action=Save"""
    $sToast &= "            activationType=""background""/>"
    $sToast &= "    <!-- Button 4 -->"
    $sToast &= "    <action content=""Open settings"""
    $sToast &= "            arguments=""action=Open"""
    $sToast &= "            activationType=""background""/>"
    $sToast &= "    <!-- Button 5 -->"
    $sToast &= "    <action content=""Dismiss"""
    $sToast &= "            arguments=""action=Dismiss"""
    $sToast &= "            activationType=""background""/>"
    #cs ; --- No more than 5 buttons allowed ---
    $sToast &= "    <!-- Button 6 -->"
    $sToast &= "    <action content=""Snooze"""
    $sToast &= "            arguments=""action=Snooze"""
    $sToast &= "            activationType=""background""/>"
    #ce ; --- No more than 5 buttons allowed ---
    $sToast &= "  </actions>"
    $sToast &= ' <audio src=''ms-winsoundevent:Notification.Looping.Alarm'' loop=''false''/>'
    $sToast &= "</toast>"
    ;#ce
    Local $pToast = _Toast_CreateToastNotificationFromXmlString($sToast)

    If @error <> 0 Then
        _GUICtrlRichEdit_AppendText($hRich, _WinAPI_GetErrorMessage(@error))
        Return
    EndIf

    _Toast_Show($pToast)
    _GUICtrlRichEdit_AppendText($hRich, $pToast & @TAB & "VarGetType: " & VarGetType($pToast) & @CRLF)
EndFunc   ;==>ToastFromXmlString

; https://learn.microsoft.com/en-us/windows/win32/api/notificationactivationcallback/nf-notificationactivationcallback-inotificationactivationcallback-activate
Func OnToastActivation($pSelf, $appUserModelId, $invokedArgs, $data, $count)
    _GUICtrlRichEdit_AppendText($hRich, _
            "Toast activated!" & @CRLF _
             & "    " & "appUserModelId: " & $appUserModelId & @TAB & "VarGetType: " & VarGetType($appUserModelId) & @CRLF _
             & "    " & "invokedArgs: " & $invokedArgs & @TAB & "VarGetType: " & VarGetType($invokedArgs) & @CRLF _
             & "    " & "$data: " & $data & @TAB & "VarGetType: " & VarGetType($data) & @TAB & DllStructGetData($data, 1) & @CRLF _ ; ??? also _WinAPI_GetString ... no good as well
             & "    " & "$count: " & $count & @TAB & "VarGetType: " & VarGetType($count) & @CRLF _
            )
    _GUICtrlRichEdit_AppendText($hRich, @CRLF & "-----------------------------" & @CRLF)
    Local $pData = $data
    For $i = 1 To $count
        $tData = DllStructCreate('PTR Key;PTR Value;', $pData)
        $key = _WinAPI_GetString($tData.Key)
        $value = _WinAPI_GetString($tData.Value)
        ;  ConsoleWrite(StringFormat('"%s"="%s"\n', $key, $value))
        _GUICtrlRichEdit_AppendText($hRich, StringFormat('"%s"="%s"\n', $key, $value))
        $pData += DllStructGetSize($tData)
    Next

    Return $_Toast_S_OK
EndFunc   ;==>OnToastActivation

Func GUI_CLOSE()
    Exit
EndFunc   ;==>GUI_CLOSE

 

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

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...