# # NLED.mscr - Monitors notifications and turns on and off the notification LED accordingly. # # check dependencies If ( NOT FileExists( "\Windows\LEDUp.exe" ) ) Message ( "Installation of LEDUp.exe is required! Exiting...", "NLED script" ) Exit EndIf # initialize variables LedOn = FALSE Notify = FALSE BttMon = FALSE # start notification check loop While ( 1 ) # check the registry for any notifications Notify = RegValueExists( "HKLM", "System\State\Shell\Notifications\Active", "CLSID" ) BttMon = RegRead( "HKLM", "System\State\Shell\Notifications\Active", "CLSID" ) If ( BttMon eq "{E58E542E-EFA1-48A6-A42C-01BF391C96F2}" ) Notify = FALSE EndIf # turn on the led if any notifications are pending. Keep turning on each iteration since # the OS turns it off whenever there is a new notification. If ( Notify ) RunWait( "\Windows\LEDUp.exe", "0 1" ) LedOn = TRUE EndIf # turn off the led if no notifications are pending If ( LedOn && NOT Notify ) RunWait( "\Windows\LEDUp.exe", "0 0" ) LedOn = FALSE EndIf # wait 2 seconds Sleep( 2000 ) EndWhile