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

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

View File

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