mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-06-30 12:41:46 +02:00
Improved turn-volume-down.ps1 and turn-volume-up.ps1
This commit is contained in:
@ -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"
|
||||
|
@ -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"
|
||||
|
Reference in New Issue
Block a user