Jump to content

Autoit notifications do not stay in Windows 11 notification centre


Go to solution Solved by Melba23,

Recommended Posts

Posted

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.

Posted

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. 

  Reveal hidden contents

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.

Posted (edited)

  

  On 3/29/2024 at 12:46 PM, Nine said:

Ah, I see, good strategy !

Expand  

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 🤦‍♂️
Posted (edited)

@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
  • 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
  • Recently Browsing   0 members

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