2023-10-31 13:03:45 +01:00
|
|
|
|
<#
|
2023-03-19 19:27:52 +01:00
|
|
|
|
.SYNOPSIS
|
2024-03-06 09:01:18 +01:00
|
|
|
|
Switches Web browser tabs
|
2023-03-19 19:27:52 +01:00
|
|
|
|
.DESCRIPTION
|
2024-03-06 09:01:18 +01:00
|
|
|
|
This PowerShell script switches automatically from tab to tab every <n> seconds (by pressing Ctrl + PageDown).
|
|
|
|
|
.PARAMETER timeInterval
|
|
|
|
|
Specifies the time interval in seconds (10sec per default)
|
2023-03-19 19:27:52 +01:00
|
|
|
|
.EXAMPLE
|
2024-03-06 09:01:18 +01:00
|
|
|
|
PS> ./switch-tabs.ps1
|
|
|
|
|
⏳ Switching from tab to tab automatically every 10 seconds...
|
|
|
|
|
(click the Web browser to activate it - press <Ctrl C> here to stop it)
|
2023-03-19 19:27:52 +01:00
|
|
|
|
.NOTES
|
2023-03-20 07:57:12 +01:00
|
|
|
|
Author: Markus Fleschutz / License: CC0
|
2023-03-19 19:27:52 +01:00
|
|
|
|
.LINK
|
2024-03-06 09:01:18 +01:00
|
|
|
|
https://github.com/fleschutz/PowerShell
|
2023-03-19 19:27:52 +01:00
|
|
|
|
#>
|
|
|
|
|
|
2024-03-06 09:01:18 +01:00
|
|
|
|
param([int]$timeInterval = 10) # in seconds
|
2023-03-19 19:27:52 +01:00
|
|
|
|
|
|
|
|
|
try {
|
2024-03-06 09:01:18 +01:00
|
|
|
|
Write-Host "⏳ Switching from tab to tab automatically every $timeInterval seconds..."
|
|
|
|
|
Write-Host " (click the Web browser 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}")
|
2024-03-06 09:01:18 +01:00
|
|
|
|
Start-Sleep -seconds $timeInterval
|
2023-03-19 19:27:52 +01:00
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
|
}
|