mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-03-25 21:46:43 +01:00
Updated open-dashboards.ps1 and switch-tabs.ps1
This commit is contained in:
parent
95e3305c9d
commit
c1104a14af
@ -3,9 +3,12 @@
|
||||
Open web dashboards
|
||||
.DESCRIPTION
|
||||
This PowerShell script launches the Web browser with 20 tabs of popular dashboard websites.
|
||||
.PARAMETER interval
|
||||
Specifies the time interval (110ms per default)
|
||||
.EXAMPLE
|
||||
PS> ./open-dashboards.ps1
|
||||
✅ Launching Web browser with 20 tabs showing: Toggl Track, Google Calendar, Google Mail, Google Keep, Google Photos, Google News, Outlook Mail, CNN News, GitHub Explore, FlightRadar24, Earthquake Watch, Live Cyber Threat Map, Live Traffic, Netflix Top 10, YouTube Music Charts, Webcams, Peak Zugspitze, Airport Salzburg, Windy Weather Radar, Windy Weather Temperatures, (Hint: execute './switch-tabs.ps1' for automated tab switching)
|
||||
✅ Launching Web browser with 20 tabs showing: Toggl Track, Google Calendar, Google Mail, ...
|
||||
NOTE: Execute './switch-tabs.ps1' to switch from tab to tab automatically.
|
||||
...
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
@ -13,18 +16,22 @@
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
#>
|
||||
|
||||
param([int]$interval = 110) # milliseconds
|
||||
|
||||
try {
|
||||
Write-Progress "Reading Data/popular-dashboards.csv..."
|
||||
$table = Import-CSV "$PSScriptRoot/../data/popular-dashboards.csv"
|
||||
$numRows = $table.Length
|
||||
Write-Progress -completed " "
|
||||
Write-Progress -completed "Done."
|
||||
|
||||
Write-Host "✅ Launching Web browser with 20 tabs showing: " -noNewline
|
||||
foreach($row in $table) {
|
||||
Write-Host "$($row.NAME), " -noNewline
|
||||
& "$PSScriptRoot/open-default-browser.ps1" "$($row.URL)"
|
||||
Start-Sleep -milliseconds 100
|
||||
Start-Sleep -milliseconds $interval
|
||||
}
|
||||
Write-Host "(Hint: execute './switch-tabs.ps1' for automated tab switching)"
|
||||
Write-Host ""
|
||||
Write-Host "NOTE: Execute './switch-tabs.ps1' to switch from tab to tab automatically."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -1,27 +1,29 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Switches browser tabs
|
||||
Switches Web 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)
|
||||
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)
|
||||
.EXAMPLE
|
||||
PS> ./switch-tabs
|
||||
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)
|
||||
.NOTES
|
||||
Author: Markus Fleschutz / License: CC0
|
||||
.LINK
|
||||
https://github.com/fleschutz/talk2windows
|
||||
https://github.com/fleschutz/PowerShell
|
||||
#>
|
||||
|
||||
param([int]$Interval = 10) # in seconds
|
||||
param([int]$timeInterval = 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)"
|
||||
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)"
|
||||
$obj = New-Object -com wscript.shell
|
||||
while ($true) {
|
||||
$obj.SendKeys("^{PGDN}")
|
||||
Start-Sleep -seconds $Interval
|
||||
Start-Sleep -seconds $timeInterval
|
||||
}
|
||||
exit 0 # success
|
||||
} catch {
|
||||
|
Loading…
Reference in New Issue
Block a user