Need to set audible alarm for being plugged in but not charging.


  1. Posts : 2
    Windows 10
       #1

    Need to set audible alarm for being plugged in but not charging.


    Sometimes, when my W10 laptop is plugged in, and presumably charging, the plug comes out of the outlet, or the outlet is turned off, the computer doesn't actually charge, and, later, my computer runs out of power. My question is, does anyone have specific knowledge of a specific app or script, etc, that will specifically set an audible alarm (that's an alarm that makes an actual noise) when the computer is plugged in but not charging. (I used to be able to set a clear visual signal, but W10 no longer allows this.) Windows 10, version 1909 (OS Build 18363.1256)
      My Computer


  2. Posts : 42,984
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #2

    Hi, there are many battery monitors out there that can alert you when your battery reaches a threshold for example.

    Here's one that generates an audible and visual notification when power is applied or disconnected.
    Need to set audible alarm for being plugged in but not charging.-1.pngNeed to set audible alarm for being plugged in but not charging.-2.png

    Bit of a weird name, but I've just tried it as you can see- connecting and disconnecting power.
    BatteryDeley: Low laptop battery alert - Scripts and Functions - AutoHotkey Community

    Just run the exe file from the zip.

    As the Autohotkey source code is provided, you can even modify it yourself.

    Rt click tray icon, Settings- lots of things you can change. Also looks as if it can generate alerts at different charge levels, which Windows also provides to some extent:
    How to Set Low Battery Warnings on Your Windows 10 Laptop - dummies
      My Computers


  3. Posts : 2
    Windows 10
    Thread Starter
       #3

    Ummmmmmmmmm, yeah.

    This all seems to be about battery monitoring. I don't see anything about an alarm that starts (and continues) if the laptop is plugged in and not charging. An audible tone that happens when the plug goes in or out (and hopefully when the power dies with the plug in) would work _if_and_only_if_ the tone _continues_ _sounding_ as long as the laptop is plugged in and not charging. None of the many battery monitors I have tried does anything like that, so if your pick actually does the thing I asked about in my original question does that I will be very, very surprised.

    So my question now is: Do you specifically know of a specific setting in this (prima facie wrong) app that will specifically do the specific thing I am specifically asking about, which is to find an app that sounds, and continues to sound an alarm when my laptop is plugged in, but not charging, irrespective of the present battery level? Remember, I am not looking to be told about low battery alarms. Low battery alarms do not solve my problem.

    - - - Updated - - -

    Note, a power setting that darkens the screen when the laptop is not charging would work as well. (Again, low battery alarms, battery monitors, battery state displays, and so on are not what I am looking for here.)
      My Computer


  4. Posts : 42,984
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #4

    Umm, yeah.


    Thank you very much for your reply.


    I showed the screenshots about connection and disconnection.

    I only found it for you - uniquely, as the source code is available, you can customise it in addition to the various parameters you can set. I don't use it myself so can comment no further. Good luck with your search.
      My Computers


  5. Posts : 16,948
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #5

    Battery detector - VBScript


    squiptryx said:
    Note, a power setting that darkens the screen when the laptop is not charging would work as well.
    I use a vbs script to alter the colour of my TitleBars when AC power is not present.
    - The script detects the presence or absence of mains power not whether or not battery charging is taking place.
    - I start it with Task scheduler at user login and it runs in the background until it detects a power change.
    - My attitude to where to store scripts is explained in set up Tools folder - TenForums
    - I have had to set a Windows defender exclusion for the folder my script is in because WD has started to report a false positive that it is a trojan [the fact that it is false is made clear by reading the script in Notepad].
    - I find that this TitleBar change is sufficient. Whilst subtle enough to avoid annoying me if I am on battery power deliberately, it is visible enough to ensure that I am aware of the change [in case it was inadvertent]. It also reverts to the original colour when power is restored.

    Mains power connected
    Need to set audible alarm for being plugged in but not charging.-green-titlebar.png

    Battery power in use - mains power disconnected
    Need to set audible alarm for being plugged in but not charging.-orange-titlebar.png


    Here are the script & the Task scheduler task definition for launching it.BatteryDetector.zip
    and here is the script in text form

    Code:
    ' This script changes the active window TitleBar colour when a change of power source [AC/DC] is detected
    ' - I find this to be a nice subtle indicator that is not easily missed yet does not distract me from what I'm doing.
    ' - Settings, Personalisation, Colours, Accent colour does not reflect these changes when they are done directly on the Registry value but the changes do take effect
    
    ' This script is launched at user logon by a TS Task
    
    ' This script was based on code originally posted by 'b w' on 17th March 2010 at
    ' windows 7 - Is there a way to execute a program on power events? - Super User
    ' http://superuser.com/questions/121045/is-there-a-way-to-execute-a-program-on-power-events
    
    ' The two lines beginning CreateObject("WScript.Shell").Run ... do the Registry changes
     ' - The change to the TitleBar colour of the active window happens within a second
     ' - I would normally add the arguments , 0 or , 7 to make the cmds run hidden or minimised but, in this case, doing so stops the TitleBar colour of the active window changing until the next time any window is switched
     ' - as a result of both those arguments being omitted, there is a brief flash onscreen as the cmd window opens & closes
    
    ' Since sometime in September 2020, Windows defender has started detecting this script as a Trojan so I have had to Restore then Allow it.
    ' - I have since added its folder as a WD Exclusion
    ' - During this period, WD has also started reporting false positives on several of my innocuous vba & command scripts
    
    Dim battery_status, prev_status
    prev_status = CheckBattery
    Set colMonitoredEvents = GetObject("winmgmts:\\.\root\cimv2")._
    ExecNotificationQuery("Select * from Win32_PowerManagementEvent")
    Do
        Set strLatestEvent = colMonitoredEvents.NextEvent
        If strLatestEvent.EventType = 10 Then
            battery_status = CheckBattery
            If battery_status <> prev_status Then
                If battery_status = 1 Then
                    ' Action to take upon changing to battery power
                   ' - Orange
                    CreateObject("WScript.Shell").Run "cmd.exe /C reg add HKCU\Software\Microsoft\Windows\DWM /v ""AccentColor"" /t REG_DWORD /d 4278237695 /f "
                ElseIf battery_status = 2 Then
                    ' Action to take upon changing to AC power
                    ' - Dark green
                    CreateObject("WScript.Shell").Run "cmd.exe /C reg add HKCU\Software\Microsoft\Windows\DWM /v ""AccentColor"" /t REG_DWORD /d 4282288400 /f "
                End If
            End If
        End If
        prev_status = battery_status
    Loop
    
    Function CheckBattery
        Dim oWMI, items, item
        Set oWMI = GetObject("winmgmts:\\.\root\cimv2")
        Set items = oWMI.ExecQuery("Select * from Win32_Battery",,48)
        For Each item in items
            If item.BatteryStatus = 1 Then
                CheckBattery = 1
                Exit Function
            ElseIf item.BatteryStatus = 2 then
                CheckBattery = 2
                Exit Function
            End If
        Next
    End Function

    Denis
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 06:19.
Find Us




Windows 10 Forums