2023-07-29 10:34:04 +02:00
|
|
|
*switch-tabs.ps1*
|
|
|
|
================
|
2023-05-26 12:20:18 +02:00
|
|
|
|
|
|
|
This PowerShell script switches browser tabs automatically every <n> seconds (by pressing Ctrl + PageDown).
|
|
|
|
|
2023-07-29 10:04:38 +02:00
|
|
|
Parameters
|
|
|
|
----------
|
2023-05-26 12:20:18 +02:00
|
|
|
```powershell
|
2023-07-29 10:15:44 +02:00
|
|
|
PS> ./switch-tabs.ps1 [[-Interval] <Int32>] [<CommonParameters>]
|
2023-05-26 12:20:18 +02:00
|
|
|
|
|
|
|
-Interval <Int32>
|
|
|
|
Specifies the switch interval in seconds (10 sec per default)
|
|
|
|
|
|
|
|
Required? false
|
|
|
|
Position? 1
|
|
|
|
Default value 10
|
|
|
|
Accept pipeline input? false
|
|
|
|
Accept wildcard characters? false
|
|
|
|
|
|
|
|
[<CommonParameters>]
|
|
|
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
|
|
|
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
|
|
|
|
```
|
|
|
|
|
2023-07-29 10:04:38 +02:00
|
|
|
Example
|
|
|
|
-------
|
2023-05-26 12:20:18 +02:00
|
|
|
```powershell
|
|
|
|
PS> ./switch-tabs
|
|
|
|
|
|
|
|
```
|
|
|
|
|
2023-07-29 10:04:38 +02:00
|
|
|
Notes
|
|
|
|
-----
|
2023-05-26 12:20:18 +02:00
|
|
|
Author: Markus Fleschutz / License: CC0
|
|
|
|
|
2023-07-29 10:04:38 +02:00
|
|
|
Related Links
|
|
|
|
-------------
|
2023-05-26 12:20:18 +02:00
|
|
|
https://github.com/fleschutz/talk2windows
|
|
|
|
|
2023-07-29 10:04:38 +02:00
|
|
|
Script Content
|
|
|
|
--------------
|
2023-05-26 12:20:18 +02:00
|
|
|
```powershell
|
|
|
|
<#
|
|
|
|
.SYNOPSIS
|
|
|
|
Switches browser tabs
|
|
|
|
.DESCRIPTION
|
|
|
|
This PowerShell script switches browser tabs automatically every <n> seconds (by pressing Ctrl + PageDown).
|
|
|
|
.PARAMETER Interval
|
|
|
|
Specifies the switch interval in seconds (10 sec per default)
|
|
|
|
.EXAMPLE
|
|
|
|
PS> ./switch-tabs
|
|
|
|
.NOTES
|
|
|
|
Author: Markus Fleschutz / License: CC0
|
|
|
|
.LINK
|
|
|
|
https://github.com/fleschutz/talk2windows
|
|
|
|
#>
|
|
|
|
|
|
|
|
param([int]$Interval = 10) # in seconds
|
|
|
|
|
|
|
|
try {
|
|
|
|
Write-Host "⏳ Switching browser tabs automatically every $Interval seconds..."
|
|
|
|
Write-Host " (click into the browser window to activate it, press Ctrl + C here to stop it)"
|
|
|
|
$obj = New-Object -com wscript.shell
|
|
|
|
while ($true) {
|
|
|
|
$obj.SendKeys("^{PGDN}")
|
|
|
|
Start-Sleep -seconds $Interval
|
|
|
|
}
|
|
|
|
exit 0 # success
|
|
|
|
} catch {
|
|
|
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2023-09-20 17:05:11 +02:00
|
|
|
*(generated by convert-ps2md.ps1 using the comment-based help of switch-tabs.ps1 as of 09/20/2023 17:04:44)*
|