2024-01-25 13:37:12 +01:00
|
|
|
Script: *switch-tabs.ps1*
|
|
|
|
========================
|
2023-05-26 12:20:18 +02:00
|
|
|
|
2024-03-27 17:36:59 +01:00
|
|
|
This PowerShell script switches automatically from tab to tab every <n> seconds (by pressing Ctrl + PageDown).
|
2023-05-26 12:20:18 +02:00
|
|
|
|
2023-07-29 10:04:38 +02:00
|
|
|
Parameters
|
|
|
|
----------
|
2023-05-26 12:20:18 +02:00
|
|
|
```powershell
|
2024-03-27 17:36:59 +01:00
|
|
|
PS> ./switch-tabs.ps1 [[-timeInterval] <Int32>] [<CommonParameters>]
|
2023-05-26 12:20:18 +02:00
|
|
|
|
2024-03-27 17:36:59 +01:00
|
|
|
-timeInterval <Int32>
|
|
|
|
Specifies the time interval in seconds (10sec per default)
|
2023-05-26 12:20:18 +02:00
|
|
|
|
|
|
|
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
|
2024-03-27 17:36:59 +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-05-26 12:20:18 +02:00
|
|
|
|
|
|
|
```
|
|
|
|
|
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
|
|
|
|
-------------
|
2024-03-27 17:36:59 +01:00
|
|
|
https://github.com/fleschutz/PowerShell
|
2023-05-26 12:20:18 +02:00
|
|
|
|
2023-07-29 10:04:38 +02:00
|
|
|
Script Content
|
|
|
|
--------------
|
2023-05-26 12:20:18 +02:00
|
|
|
```powershell
|
|
|
|
<#
|
|
|
|
.SYNOPSIS
|
2024-03-27 17:36:59 +01:00
|
|
|
Switches Web browser tabs
|
2023-05-26 12:20:18 +02:00
|
|
|
.DESCRIPTION
|
2024-03-27 17:36:59 +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-05-26 12:20:18 +02:00
|
|
|
.EXAMPLE
|
2024-03-27 17:36:59 +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-05-26 12:20:18 +02:00
|
|
|
.NOTES
|
|
|
|
Author: Markus Fleschutz / License: CC0
|
|
|
|
.LINK
|
2024-03-27 17:36:59 +01:00
|
|
|
https://github.com/fleschutz/PowerShell
|
2023-05-26 12:20:18 +02:00
|
|
|
#>
|
|
|
|
|
2024-03-27 17:36:59 +01:00
|
|
|
param([int]$timeInterval = 10) # in seconds
|
2023-05-26 12:20:18 +02:00
|
|
|
|
|
|
|
try {
|
2024-03-27 17:36:59 +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-05-26 12:20:18 +02:00
|
|
|
$obj = New-Object -com wscript.shell
|
|
|
|
while ($true) {
|
|
|
|
$obj.SendKeys("^{PGDN}")
|
2024-03-27 17:36:59 +01:00
|
|
|
Start-Sleep -seconds $timeInterval
|
2023-05-26 12:20:18 +02:00
|
|
|
}
|
|
|
|
exit 0 # success
|
|
|
|
} catch {
|
|
|
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2024-05-19 10:25:56 +02:00
|
|
|
*(generated by convert-ps2md.ps1 using the comment-based help of switch-tabs.ps1 as of 05/19/2024 10:25:26)*
|