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