Chazg Posted March 14 Share Posted March 14 Hi, Since upgrading to Windows 11 a few months ago I am having problems with my AutoIt script notifications. I have a .exe file compiled with AutoIt that runs on my Windows 11 PC as a background process. The .exe file runs automatic backups of very important data every 3 hours. The .exe has a tray icon where I can also launch manual backups as required. Once automatic or manual backups are complete the tray icon displays a message detailing any errors with the backup process. It is here that I am having problems. The message appears on the screen as normal. In Windows 10, the message stayed in Windows notification centre until it was removed by the user. This was useful if I was away from my PC when the message was initially displayed. However, in Windows 11 the notifications disappears instantly from the notification centre so if Ido not see the tray icon notification I dont know if any errors occured during the process. Is there any way to keep the message in the notification centre until it is dismissed? Notifications from other apps will appear in the notification centre until dismissed so why not my autoit exe file's notifications? For a fix I have written the info displayed by the notification to text within the tray icon but would prefer the notification system I had with Windows 10. I have asked about this on numerous Windows forums but as other notifications work as expected no one can help me with my problem Any help much appreciated. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 14 Moderators Share Posted March 14 Chazg, I cannot help with the Win 11 problem, but using my Notify UDF (the link is in my sig) will offer you an alternative method of displaying the results from your exe. M23 Chazg 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Chazg Posted March 14 Author Share Posted March 14 Hi Melba23, Thanks for your quick response, I'll take a look. Link to comment Share on other sites More sharing options...
Nine Posted March 14 Share Posted March 14 @Chazg Do you use ShellNotifyIcon Win32 API to push notification ? On Win10, it seems to be working fine, cannot test it on Win11. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Chazg Posted March 19 Author Share Posted March 19 @Nine could you give me an example of how to use ShellNotifyIcon Win32 API to push notifications? I have looked at the documentation but can't get anything to work! Link to comment Share on other sites More sharing options...
Nine Posted March 19 Share Posted March 19 Normally I would have asked you to show what you have tried, but since I have the example up and ready, here you go : expandcollapse popup#NoTrayIcon #include <APIShellExConstants.au3> #include <WinAPIShellEx.au3> Opt("MustDeclareVars", True) OnAutoItExitRegister(OnAutoItExit) HotKeySet("{ESC}", Terminate) Local $hGUI = GUICreate("") ; prepare data Global $tNOTIFYICONDATA = DllStructCreate($tagNOTIFYICONDATA_V4) $tNOTIFYICONDATA.Size = DllStructGetSize($tNOTIFYICONDATA) $tNOTIFYICONDATA.hWnd = $hGUI $tNOTIFYICONDATA.Flags = $NIF_ICON + $NIF_TIP $tNOTIFYICONDATA.tip = "Test" $tNOTIFYICONDATA.Version = 4 ; create icon $tNOTIFYICONDATA.ID = 2 $tNOTIFYICONDATA.hIcon = _WinAPI_ShellExtractIcon(@SystemDir & '\shell32.dll', 166, 16, 16) _WinAPI_ShellNotifyIcon($NIM_ADD, $tNOTIFYICONDATA) ; push notification $tNOTIFYICONDATA.Flags = $NIF_INFO $tNOTIFYICONDATA.Info = "Info 256 bytes" $tNOTIFYICONDATA.InfoTitle = "Info title 64 bytes" $tNOTIFYICONDATA.InfoFlags = $NIIF_USER ; user icon $tNOTIFYICONDATA.hBalloonIcon = _WinAPI_ShellExtractIcon(@SystemDir & '\shell32.dll', 130, 16, 16) _WinAPI_ShellNotifyIcon($NIM_MODIFY, $tNOTIFYICONDATA) While Sleep(100) WEnd Func OnAutoItExit() ; delete icon _WinAPI_ShellNotifyIcon($NIM_DELETE, $tNOTIFYICONDATA) EndFunc ;==>OnAutoItExit Func Terminate() Exit EndFunc argumentum and Chazg 1 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Chazg Posted March 20 Author Share Posted March 20 Many thanks @Nine, using your example produces exactly the same result as detailed in my original post, that is: The message appears on the screen and in the notification centre. When the notification disappears it also disapears from the notification centre. So, if I am not at my PC when the notification is displayed I have no record in the notification centre that the message was there at all! Very annoying! Link to comment Share on other sites More sharing options...
Moderators Solution Melba23 Posted March 20 Moderators Solution Share Posted March 20 Chazg, Did you look at my Notify UDF? M23 Chazg 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Chazg Posted March 20 Author Share Posted March 20 @Melba23 Ah yes, sorry, didn't get back to you on that one. Yes, I have taken a look and it works very well in all my tests. I would like to resolve my original problem but after many weeks of trying I don't hold out much hope. My only current solution is, therefore, to use your UDF, which is great. Many thanks for your help with this. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 20 Moderators Share Posted March 20 Chazg, My pleasure - glad you found the UDF useful. M23 Chazg 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Nine Posted March 20 Share Posted March 20 Look at https://www.reddit.com/r/windows/comments/sy8gfo/can_i_stop_notifications_from_just_disappearing/ Let me know if it works in Win11 Chazg 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Chazg Posted March 20 Author Share Posted March 20 (edited) Thanks for the link. In my tests changing the value of 'Messageduration' changes the time that the message is displayed on the screen. However as before, once the message disappears it disappears completely from the notification centre. I really don't understand as notifications from other apps are displayed on screen and then once they have disappeared they are visible in the notifications centre until I click on the x to remove them. I have checked the notifications settings for autoit scripts and they are the same as for those applications that work correctly. Edited March 20 by Chazg Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 20 Moderators Share Posted March 20 Some GUIs have timeout features... Just MsgBox() off the top of my head has that option. But it's an "option", to force it on someone I don't agree with unless it's necessary for an application to continue running. At minimum there's a 5 second delay option, but max is 5 minutes unfortunately. Looks like it's time for you to write a notification pop-up logger 💪👍! Chazg 1 Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Nine Posted March 20 Share Posted March 20 If someone else has Win11, it would be nice to test my code to see if they observe the same behavior as you... Chazg 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
argumentum Posted March 20 Share Posted March 20 8 hours ago, Chazg said: When the notification disappears it also disapears from the notification centre. 47 minutes ago, Nine said: If someone else has Win11, it would be nice to test my code to see if they observe the same behavior as you... Yes, it disappears in Win11. Win10 works as expected. Chazg 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
water Posted March 20 Share Posted March 20 I see the same behaviour. Seems W10/11 does not keep old notifications. Chazg and ioa747 1 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
argumentum Posted March 20 Share Posted March 20 Side note: I have my PC with everything changed, like, everything !. But testing if stuff works, I keep a default Win 10 and Win 11 ( in Hyper-V ), just to see how it would behave for default, out of the box windows users. Chazg 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Nine Posted March 20 Share Posted March 20 @water @argumentum Thanks for testing. Now we know that the code I provided is not working as expected on Win11...Makes me wonder. Chazg and argumentum 1 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Chazg Posted March 21 Author Share Posted March 21 Many thanks to all for your tests and feedback, much appreciated. Link to comment Share on other sites More sharing options...
rsn Posted March 28 Share Posted March 28 @Nine I tried your notification code and it consistently creates an ownership reg entry on my test box: HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Notifications\Settings\Microsoft.Explorer.Notification.{EF042132-5191-5B05-CE52-68DCD8D3A677} Is there a way to create the notification key with a user defined name? Previously, I've been using TrayTip() to create the notifications but it creates a different key each run. So I've been enumerating the registry before and after to get the key name. argumentum 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now