mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-02-02 10:59:14 +01:00
Add toggle-caps-lock.ps1, toggle-num-lock.ps1, and toggle-scroll-lock.ps1
This commit is contained in:
parent
fa71267c50
commit
c1290d17e3
21
Scripts/toggle-caps-lock.ps1
Normal file
21
Scripts/toggle-caps-lock.ps1
Normal file
@ -0,0 +1,21 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Toggle Caps Lock
|
||||
.DESCRIPTION
|
||||
This PowerShell script toggles the Caps Lock key state.
|
||||
.EXAMPLE
|
||||
PS> ./toggle-caps-lock
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
#>
|
||||
|
||||
try {
|
||||
$wsh = New-Object -ComObject WScript.Shell
|
||||
$wsh.SendKeys('{CAPSLOCK}')
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
21
Scripts/toggle-num-lock.ps1
Normal file
21
Scripts/toggle-num-lock.ps1
Normal file
@ -0,0 +1,21 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Toggle Num Lock
|
||||
.DESCRIPTION
|
||||
This PowerShell script toggles the Num Lock key state.
|
||||
.EXAMPLE
|
||||
PS> ./toggle-num-lock
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
#>
|
||||
|
||||
try {
|
||||
$wsh = New-Object -ComObject WScript.Shell
|
||||
$wsh.SendKeys('{NUMLOCK}')
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
21
Scripts/toggle-scroll-lock.ps1
Normal file
21
Scripts/toggle-scroll-lock.ps1
Normal file
@ -0,0 +1,21 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Toggle Scroll Lock
|
||||
.DESCRIPTION
|
||||
This PowerShell script toggles the Scroll Lock key state.
|
||||
.EXAMPLE
|
||||
PS> ./toggle-scroll-lock
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
#>
|
||||
|
||||
try {
|
||||
$wsh = New-Object -ComObject WScript.Shell
|
||||
$wsh.SendKeys('{SCROLLLOCK}')
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
Loading…
Reference in New Issue
Block a user