Update open-dashboards.ps1

This commit is contained in:
Markus Fleschutz 2023-06-09 09:38:14 +02:00
parent 67a8cc6a28
commit c056e4ec1e

View File

@ -2,11 +2,11 @@
.SYNOPSIS
Open dashboards
.DESCRIPTION
This PowerShell script launches the Web browser with tabs of some dashboard websites.
This PowerShell script launches the Web browser with tabs of popular dashboard websites.
.EXAMPLE
PS> ./open-dashboards
(1/2) Loading Data/popular-dashboards.csv...
(2/2) Launching Web browser with tabs of dashboard websites...
(2/2) Launching Web browser with tabs: Toggl Track · Google Calendar · CNN World News...
...
.LINK
https://github.com/fleschutz/PowerShell
@ -17,20 +17,17 @@
try {
$stopWatch = [system.diagnostics.stopwatch]::startNew()
Write-Host "⏳ (1/2) Loading Data/popular-dashboards.csv..."
$Table = Import-CSV "$PSScriptRoot/../Data/popular-dashboards.csv"
$NumRows = $Table.Length
Write-Host "⏳ (2/2) Launching Web browser with tabs of dashboard websites... "
foreach($Row in $Table) {
$Name = $Row.NAME
$URL = $Row.URL
Write-Host "$Name · " -noNewline
& "$PSScriptRoot/open-default-browser.ps1" "$URL"
$table = Import-CSV "$PSScriptRoot/../Data/popular-dashboards.csv"
$numRows = $table.Length
Write-Host "⏳ (2/2) Launching Web browser with tabs: " -noNewline
foreach($row in $table) {
Write-Host "$($row.NAME) · " -noNewline
& "$PSScriptRoot/open-default-browser.ps1" "$($row.URL)"
Start-Sleep -milliseconds 50
}
Write-Host ""
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
"Hint: use switch-tabs.ps1 to switch the browser tabs automatically"
"✅ Opened $NumRows dashboards in $elapsed sec"
"✅ Opened $NumRows dashboards in $elapsed sec (Hint: use switch-tabs.ps1 to switch between browser tabs automatically)"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"