Update switch-tabs.ps1

This commit is contained in:
Markus Fleschutz 2023-03-19 19:27:52 +01:00
parent 3e6bff15b5
commit a778fa2c58

28
Scripts/switch-tabs.ps1 Normal file
View File

@ -0,0 +1,28 @@
<#
.SYNOPSIS
Presses the Next Tab hotkey
.DESCRIPTION
This PowerShell script presses the Next Tab keyboard shortcuts.
.EXAMPLE
PS> ./switch-tabs
.NOTES
Author: Markus Fleschutz / License: CC0
.LINK
https://github.com/fleschutz/talk2windows
#>
param([int]$Interval = 5) # in seconds
try {
Write-Host "Switching browser tabs every $Interval seconds (press Ctrl + C to stop it)..." -noNewline
$obj = New-Object -com wscript.shell
for ([int]$i = 0; $i -lt 1000; $i++) {
Write-Host "." -noNewline
$obj.SendKeys("^{PGDN}")
Start-Sleep -seconds $Interval
}
exit 0 # success
} catch {
& "$PSScriptRoot/_reply.ps1" "Sorry: $($Error[0])"
exit 1
}