Hey guys,
I created this process in Python and I don't need to use the BatteryInfoView.exe program.
I have Windows 11 and I'm using the "Task Scheduler" function to run in a loop that repeats itself every 5 minutes.
Here is the script
import psutil, os, time
bateria = psutil.sensors_battery()
plugado = bateria.power_plugged
if plugado:
if bateria.percent == 100:
os.startfile('D:\Downloads\Bateria\plugOff.bat')
time.sleep(10)
else:
pass
else:
if bateria.percent <= 20:
os.startfile('D:\Downloads\Bateria\plugON.bat')
time.sleep(10)
else:
pass
Where
The file plugOff.bat has the code
tcmdWin.exe --computer your_name_computer --trigger plugOff
The file plugOn.bat has the code
tcmdWin.exe --computer your_name_computer --trigger plugOn