Skip to content

Switch-Tabs

Switches Web browser tabs

param([int]$timeInterval = 10) # in seconds

try {
	Write-Host "? Switching from tab to tab automatically every $timeInterval seconds..."
	Write-Host "?? Hint: click the Web browser to activate it. Press <Ctrl> <C> here to stop it."
	$obj = New-Object -com wscript.shell
	while ($true) {
		$obj.SendKeys("^{PGDN}")
		Start-Sleep -seconds $timeInterval
	}
	exit 0 # success
} catch {
	"?? ERROR: $($Error[0]) (script line $($_.InvocationInfo.ScriptLineNumber))"
	exit 1
}

Specifies the time interval in seconds (10sec per default)

An interactive directory of PowerShell scripts.