diff --git a/Scripts/toggle-caps-lock.ps1 b/Scripts/toggle-caps-lock.ps1 new file mode 100644 index 00000000..88007514 --- /dev/null +++ b/Scripts/toggle-caps-lock.ps1 @@ -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 +} \ No newline at end of file diff --git a/Scripts/toggle-num-lock.ps1 b/Scripts/toggle-num-lock.ps1 new file mode 100644 index 00000000..9ad8fed5 --- /dev/null +++ b/Scripts/toggle-num-lock.ps1 @@ -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 +} diff --git a/Scripts/toggle-scroll-lock.ps1 b/Scripts/toggle-scroll-lock.ps1 new file mode 100644 index 00000000..512f7526 --- /dev/null +++ b/Scripts/toggle-scroll-lock.ps1 @@ -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 +} \ No newline at end of file