2023-10-31 11:25:11 +01:00
|
|
|
<#
|
2023-03-19 19:27:52 +01:00
|
|
|
.SYNOPSIS
|
2023-03-20 07:57:12 +01:00
|
|
|
Switches browser tabs
|
2023-03-19 19:27:52 +01:00
|
|
|
.DESCRIPTION
|
2023-03-20 07:57:12 +01:00
|
|
|
This PowerShell script switches browser tabs automatically every <n> seconds (by pressing Ctrl + PageDown).
|
2023-03-30 11:36:38 +02:00
|
|
|
.PARAMETER Interval
|
|
|
|
Specifies the switch interval in seconds (10 sec per default)
|
2023-03-19 19:27:52 +01:00
|
|
|
.EXAMPLE
|
|
|
|
PS> ./switch-tabs
|
|
|
|
.NOTES
|
2023-03-20 07:57:12 +01:00
|
|
|
Author: Markus Fleschutz / License: CC0
|
2023-03-19 19:27:52 +01:00
|
|
|
.LINK
|
|
|
|
https://github.com/fleschutz/talk2windows
|
|
|
|
#>
|
|
|
|
|
2023-03-30 11:36:38 +02:00
|
|
|
param([int]$Interval = 10) # in seconds
|
2023-03-19 19:27:52 +01:00
|
|
|
|
|
|
|
try {
|
2023-03-30 11:38:35 +02:00
|
|
|
Write-Host "⏳ Switching browser tabs automatically every $Interval seconds..."
|
2023-03-20 12:57:29 +01:00
|
|
|
Write-Host " (click into the browser window to activate it, press Ctrl + C here to stop it)"
|
2023-03-19 19:27:52 +01:00
|
|
|
$obj = New-Object -com wscript.shell
|
2023-03-30 11:36:38 +02:00
|
|
|
while ($true) {
|
2023-03-19 19:27:52 +01:00
|
|
|
$obj.SendKeys("^{PGDN}")
|
|
|
|
Start-Sleep -seconds $Interval
|
|
|
|
}
|
|
|
|
exit 0 # success
|
|
|
|
} catch {
|
2023-03-20 07:57:12 +01:00
|
|
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
2023-03-19 19:27:52 +01:00
|
|
|
exit 1
|
|
|
|
}
|