mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-09 05:04:39 +02:00
Renamed folder Scripts to scripts
This commit is contained in:
30
scripts/switch-tabs.ps1
Executable file
30
scripts/switch-tabs.ps1
Executable file
@ -0,0 +1,30 @@
|
||||
<#
|
||||
.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
|
||||
}
|
Reference in New Issue
Block a user