Improved turn-volume-down.ps1 and turn-volume-up.ps1

This commit is contained in:
Markus Fleschutz 2020-12-28 13:49:52 +00:00
parent 40b7b500af
commit ed8618dbae
3 changed files with 14 additions and 10 deletions

View File

@ -67,8 +67,8 @@ The following PowerShell scripts can be found in the [Scripts/](Scripts/) subfol
* [train-dns-cache.ps1](Scripts/train-dns-cache.ps1) - trains the DNS cache with frequently used domain names * [train-dns-cache.ps1](Scripts/train-dns-cache.ps1) - trains the DNS cache with frequently used domain names
* [translate-file.ps1](Scripts/translate-file.ps1) - translates the given file from source to target language * [translate-file.ps1](Scripts/translate-file.ps1) - translates the given file from source to target language
* [translate-text.ps1](Scripts/translate-text.ps1) - translates the given text into other languages * [translate-text.ps1](Scripts/translate-text.ps1) - translates the given text into other languages
* [turn-volume-up.ps1](Scripts/turn-volume-up.ps1) - turns the volume up * [turn-volume-up.ps1](Scripts/turn-volume-up.ps1) - turns the volume up (+10% by default)
* [turn-volume-down.ps1](Scripts/turn-volume-down.ps1) - turns the volume down * [turn-volume-down.ps1](Scripts/turn-volume-down.ps1) - turns the volume down (-10% by default)
* [txt2wav.ps1](Scripts/txt2wav.ps1) - converts text into a audio .WAV file * [txt2wav.ps1](Scripts/txt2wav.ps1) - converts text into a audio .WAV file
* [unmute-audio.ps1](Scripts/unmute-audio.ps1) - unmutes audio * [unmute-audio.ps1](Scripts/unmute-audio.ps1) - unmutes audio
* [weather.ps1](Scripts/weather.ps1) - prints the current weather forecast * [weather.ps1](Scripts/weather.ps1) - prints the current weather forecast

View File

@ -1,14 +1,16 @@
#!/snap/bin/powershell #!/snap/bin/powershell
# Syntax: ./turn-volume-down.ps1 # Syntax: ./turn-volume-down.ps1 [<percent>]
# Description: turns the volume down # Description: turns the volume down (-10% by default)
# Author: Markus Fleschutz # Author: Markus Fleschutz
# Source: github.com/fleschutz/PowerShell # Source: github.com/fleschutz/PowerShell
# License: CC0 # License: CC0
Param([Int]$Percent = 10)
try { try {
$obj = new-object -com wscript.shell $obj = New-Object -com wscript.shell
for ($i = 0; $i -lt 5; $i++) { for ($i = 0; $i -lt $Percent; $i += 2) {
$obj.SendKeys([char]174) # each tick is -2% $obj.SendKeys([char]174) # each tick is -2%
} }
write-output "OK" write-output "OK"

View File

@ -1,14 +1,16 @@
#!/snap/bin/powershell #!/snap/bin/powershell
# Syntax: ./turn-volume-up.ps1 # Syntax: ./turn-volume-up.ps1 [<percent>]
# Description: turns the volume up # Description: turns the volume up (+10% by default)
# Author: Markus Fleschutz # Author: Markus Fleschutz
# Source: github.com/fleschutz/PowerShell # Source: github.com/fleschutz/PowerShell
# License: CC0 # License: CC0
Param([Int]$Percent = 10)
try { try {
$obj = new-object -com wscript.shell $obj = New-Object -com wscript.shell
for ($i = 0; $i -lt 5; $i++) { for ($i = 0; $i -lt $Percent; $i += 2) {
$obj.SendKeys([char]175) # each tick is +2% $obj.SendKeys([char]175) # each tick is +2%
} }
write-output "OK" write-output "OK"