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

This commit is contained in:
Markus Fleschutz 2020-12-28 10:51:54 +00:00
parent 3876f20bd3
commit f8e4c0b5ac
3 changed files with 40 additions and 0 deletions

View File

@ -66,6 +66,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
* [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
* [turn-volume-up.ps1](Scripts/turn-volume-up.ps1) - turns the volume up
* [turn-volume-down.ps1](Scripts/turn-volume-down.ps1) - turns the volume down
* [txt2wav.ps1](Scripts/txt2wav.ps1) - converts text into a audio .WAV file
* [weather.ps1](Scripts/weather.ps1) - prints the current weather forecast
* [weather-alert.ps1](Scripts/weather-alert.ps1) - checks the current weather for critical values

19
Scripts/turn-volume-down.ps1 Executable file
View File

@ -0,0 +1,19 @@
#!/snap/bin/powershell
# Syntax: ./turn-volume-down.ps1
# Description: turns the volume down
# Author: Markus Fleschutz
# Source: github.com/fleschutz/PowerShell
# License: CC0
try {
$obj = new-object -com wscript.shell
for ($i = 0; $i -lt 5; $i++) {
$obj.SendKeys([char]174) # each tick is -2%
}
write-output "OK"
exit 0
} catch {
write-error "ERROR in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}

19
Scripts/turn-volume-up.ps1 Executable file
View File

@ -0,0 +1,19 @@
#!/snap/bin/powershell
# Syntax: ./turn-volume-up.ps1
# Description: turns the volume up
# Author: Markus Fleschutz
# Source: github.com/fleschutz/PowerShell
# License: CC0
try {
$obj = new-object -com wscript.shell
for ($i = 0; $i -lt 5; $i++) {
$obj.SendKeys([char]175) # each tick is +2%
}
write-output "OK"
exit 0
} catch {
write-error "ERROR in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}