mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-15 06:28:17 +02:00
Update switch-tabs.ps1
This commit is contained in:
parent
3e6bff15b5
commit
a778fa2c58
28
Scripts/switch-tabs.ps1
Normal file
28
Scripts/switch-tabs.ps1
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Presses the Next Tab hotkey
|
||||||
|
.DESCRIPTION
|
||||||
|
This PowerShell script presses the Next Tab keyboard shortcuts.
|
||||||
|
.EXAMPLE
|
||||||
|
PS> ./switch-tabs
|
||||||
|
.NOTES
|
||||||
|
Author: Markus Fleschutz / License: CC0
|
||||||
|
.LINK
|
||||||
|
https://github.com/fleschutz/talk2windows
|
||||||
|
#>
|
||||||
|
|
||||||
|
param([int]$Interval = 5) # in seconds
|
||||||
|
|
||||||
|
try {
|
||||||
|
Write-Host "Switching browser tabs every $Interval seconds (press Ctrl + C to stop it)..." -noNewline
|
||||||
|
$obj = New-Object -com wscript.shell
|
||||||
|
for ([int]$i = 0; $i -lt 1000; $i++) {
|
||||||
|
Write-Host "." -noNewline
|
||||||
|
$obj.SendKeys("^{PGDN}")
|
||||||
|
Start-Sleep -seconds $Interval
|
||||||
|
}
|
||||||
|
exit 0 # success
|
||||||
|
} catch {
|
||||||
|
& "$PSScriptRoot/_reply.ps1" "Sorry: $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user