mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-12-16 03:30:39 +01:00
Update switch-tabs.ps1
This commit is contained in:
parent
762c7a0dd2
commit
f49d4f659d
@ -3,6 +3,8 @@
|
|||||||
Switches browser tabs
|
Switches browser tabs
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This PowerShell script switches browser tabs automatically every <n> seconds (by pressing Ctrl + PageDown).
|
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
|
.EXAMPLE
|
||||||
PS> ./switch-tabs
|
PS> ./switch-tabs
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -11,13 +13,13 @@
|
|||||||
https://github.com/fleschutz/talk2windows
|
https://github.com/fleschutz/talk2windows
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param([int]$Interval = 5) # in seconds
|
param([int]$Interval = 10) # in seconds
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Write-Host "✅ Switching browser tabs automatically every $Interval seconds..."
|
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)"
|
Write-Host " (click into the browser window to activate it, press Ctrl + C here to stop it)"
|
||||||
$obj = New-Object -com wscript.shell
|
$obj = New-Object -com wscript.shell
|
||||||
for ([int]$i = 0; $i -lt 1000; $i++) {
|
while ($true) {
|
||||||
$obj.SendKeys("^{PGDN}")
|
$obj.SendKeys("^{PGDN}")
|
||||||
Start-Sleep -seconds $Interval
|
Start-Sleep -seconds $Interval
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user