Closed MuscularPuky closed 11 months ago
I will try your modifications, and I will wait for the new events sounds you mentioned :)
if
condition here with results True
and False
powershell.exe -WindowStyle Hidden -c if ((Get-CimInstance -Class batterystatus -Namespace root\wmi).charging -eq \"True\"){(New-Object Media.SoundPlayer 'C:\WINDOWS\Media\Windows-Phone-8.1\Alert_charging.wav').PlaySync()} else {(New-Object Media.SoundPlayer 'C:\Windows\Media\windows_10x_sounds_by_bbrandis_ddqjulo\Sounds\Sounds\Alert-01.wav').PlaySync()}
- I want to know why the sounds are different in
if
condition here with resultsTrue
andFalse
powershell.exe -WindowStyle Hidden -c if ((Get-CimInstance -Class batterystatus -Namespace root\wmi).charging -eq \"True\"){(New-Object Media.SoundPlayer 'C:\WINDOWS\Media\Windows-Phone-8.1\Alert_charging.wav').PlaySync()} else {(New-Object Media.SoundPlayer 'C:\Windows\Media\windows_10x_sounds_by_bbrandis_ddqjulo\Sounds\Sounds\Alert-01.wav').PlaySync()}
That's like USB connected/disconnected sounds.
(Get-CimInstance -Class batterystatus -Namespace root\wmi).charging
returns the charging state as a boolean value. So I let to play "Alert_charging.wav" (in my directory) if True, else "Alert-01.wav". (")
Unfortuntely that not works in Task Scheduler. I think it's cuzof task scheduler limitation—it seems to delayes tasks.
Now all that's left is Battery Saving Mode problem. Windows delays the SYSTEM tasks while Battery Saving Mode is turned on on laptop, so I'm finding any solution to bypass that restrit but annoying consol window displays no matter what I do... I don't wanna use VBS or WScript but they'll be last resorts. That sounds similar to audict Logon/off with gpedit.msc.
How about using service? is that use more power than task scheduler?
How about using service? is that use more power than task scheduler?
Actually I don't know, and I can't test power usage because I don't have a laptop.
I might try a background console app that starts hidden and plays audio on a specific event. This might have low power usgae.
What is your new idea or feature?
In new canary build your task scheduler tricks work 99% cool :D
Now all that's left is Battery Saving Mode problem. Windows delays the SYSTEM tasks while Battery Saving Mode is turned on on laptop, so I'm finding any solution to bypass that restrit but annoying consol window displays no matter what I do... I don't wanna use VBS or WScript but they'll be last resorts. That sounds similar to audict Logon/off with gpedit.msc.
I studied about Kernal-Power ID 105 event. That can't separate pluged in/out, only listns "plugged", so sound plays twice.
here's my failed tries xml—escaping bothered me for few days:( charger test.txt )
I think the problem is in task scheduler, not the script.
I'll keep try to solve those problem, and i'm testing others like copy-paste sound, macOS-like ontime notify, Wi-Fi connected sound, etc.
You can mention\include the following if possible to make implementing the idea easier:
powershell.exe -WindowStyle Hidden -c if ((Get-CimInstance -Class batterystatus -Namespace root\wmi).charging -eq \"True\"){(New-Object Media.SoundPlayer 'C:\WINDOWS\Media\Windows-Phone-8.1\Alert_charging.wav').PlaySync()} else {(New-Object Media.SoundPlayer 'C:\Windows\Media\windows_10x_sounds_by_bbrandis_ddqjulo\Sounds\Sounds\Alert-01.wav').PlaySync()}
Additional context