Jump to content

Autoit notifications do not stay in Windows 11 notification centre


Go to solution Solved by Melba23,

Recommended Posts

Link to comment
Share on other sites

Not that I don't want non-necessary but I use the data in LastNotificationAddedTime to compare against the current time to create a reboot reminder notification.

Link to comment
Share on other sites

Ah, I see, good strategy !  But since it is always the same GUID, you do know what and where to search it, no ?

Anyway, there is a GUID inside the structure you can pass to the API. 

Spoiler
Quote

guidItem

Type: GUID

Windows XP and later.

  • Windows 7 and later: A registered GUID that identifies the icon. This value overrides uID and is the recommended method of identifying the icon. The NIF_GUID flag must be set in the uFlags member.
  • Windows XP and Windows Vista: Reserved; must be set to 0.

If your application is intended to run on both Windows Vista and Windows 7, it is imperative that you check the version of Windows and only specify a nonzero guidItem if on Windows 7 or later.

If you identify the notification icon with a GUID in one call to Shell_NotifyIcon, you must use that same GUID to identify the icon in any subsequent Shell_NotifyIcon calls that deal with that same icon.

To generate a GUID for use in this member, use a GUID-generating tool such as Guidgen.exe.

 

Not sure if this will work for you.  Let me know.  Could you also show the algorithm to calculate the time from a registry entry ? Thanks.

Link to comment
Share on other sites

  

On 3/29/2024 at 8:46 AM, Nine said:

Ah, I see, good strategy !

I'm humbled. Truly. 😊

I was hoping to "take ownership" of the key and make it all official looking, you know?

HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Notifications\Settings\rsn.reboot.nag

Or something like that. 🤣

I'm looking at the code for the date/time calculation and man is it a pile of slop. I never expected a real programmer to ask to see it! I'm an old school cmd scripter and it shows.

The data in LastNotificationAddedTime is in NT time epoch. And in this case I was using w32tm.exe to do the calculations. So the basic snippet looks like the following. In this example, I'm defining $iLastNotificationAddedTime when in the actual I'm fetching it from the registry.

$iLastNotificationAddedTime = "133552598496093801"

$iPID = Run( @ComSpec & ' /c for /f "tokens=1-8 delims=/ " %a in ' & "( 'w32tm /ntte " & $iLastNotificationAddedTime & "' ) do @echo %f/%d/%e %g", "", @SW_HIDE, $STDOUT_CHILD)

It changes the output from normal:

"154574 18:24:09.6093801 - 3/18/2024 2:24:09 PM"

to

"2024/3/18 2:24:09"

so I can further massage it for date math.

Edited by rsn
wrong code 🤦‍♂️
Link to comment
Share on other sites

@rsn Here the way to convert those regedit timestamps without using external program (for the fun of it...)

#include <Date.au3>

; convert Regedit time to string

Local $sTime = String(RegRead("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Notifications\Settings\Microsoft.Explorer.Notification.{EF042132-5191-5B05-CE52-68DCD8D3A677}", "LastNotificationAddedTime"))
Local $iTime = Int(StringLeft($sTime, 11))
$sTime = _DateAdd('s', $iTime, "1601/01/01 00:00:00")
Local $aTime = StringRegExp($sTime, "(.{4}).(.{2}).(.{2}).(.{2}).(.{2}).(.{2})", 1)
Local $tFile = _Date_Time_EncodeFileTime($aTime[1], $aTime[2], $aTime[0], $aTime[3], $aTime[4], $aTime[5])
$tFile = _Date_Time_FileTimeToLocalFileTime($tFile)
$sTime = _Date_Time_FileTimeToStr($tFile, 1)

ConsoleWrite($sTime & @CRLF)

 

Edited by Nine
Link to comment
Share on other sites

  • 6 months 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
 Share

  • Recently Browsing   0 members

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