mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-14 12:03:59 +01:00
75 lines
2.0 KiB
Markdown
75 lines
2.0 KiB
Markdown
*open-dashboards.ps1*
|
|
================
|
|
|
|
This PowerShell script launches the web browser with tabs of 18 dashboard websites.
|
|
|
|
Parameters
|
|
----------
|
|
```powershell
|
|
PS> ./open-dashboards.ps1 [<CommonParameters>]
|
|
|
|
[<CommonParameters>]
|
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
|
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
|
|
```
|
|
|
|
Example
|
|
-------
|
|
```powershell
|
|
PS> ./open-dashboards.ps1
|
|
⏳ (1/2) Loading Data/web-dashboards.csv...
|
|
⏳ (2/2) Launching web browser with tabs of Toggl Track · Google Calendar · CNN News...
|
|
...
|
|
|
|
```
|
|
|
|
Notes
|
|
-----
|
|
Author: Markus Fleschutz | License: CC0
|
|
|
|
Related Links
|
|
-------------
|
|
https://github.com/fleschutz/PowerShell
|
|
|
|
Script Content
|
|
--------------
|
|
```powershell
|
|
<#
|
|
.SYNOPSIS
|
|
Open web dashboards
|
|
.DESCRIPTION
|
|
This PowerShell script launches the web browser with tabs of 18 dashboard websites.
|
|
.EXAMPLE
|
|
PS> ./open-dashboards.ps1
|
|
⏳ (1/2) Loading Data/web-dashboards.csv...
|
|
⏳ (2/2) Launching web browser with tabs of Toggl Track · Google Calendar · CNN News...
|
|
...
|
|
.LINK
|
|
https://github.com/fleschutz/PowerShell
|
|
.NOTES
|
|
Author: Markus Fleschutz | License: CC0
|
|
#>
|
|
|
|
try {
|
|
$stopWatch = [system.diagnostics.stopwatch]::startNew()
|
|
Write-Host "⏳ (1/2) Loading Data/web-dashboards.csv..."
|
|
$table = Import-CSV "$PSScriptRoot/../Data/web-dashboards.csv"
|
|
$numRows = $table.Length
|
|
Write-Host "⏳ (2/2) Launching web browser with tabs of " -noNewline
|
|
foreach($row in $table) {
|
|
Write-Host "$($row.NAME) · " -noNewline
|
|
& "$PSScriptRoot/open-default-browser.ps1" "$($row.URL)"
|
|
Start-Sleep -milliseconds 100
|
|
}
|
|
Write-Host ""
|
|
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
|
"✅ Opened $NumRows web dashboards in $elapsed sec (Hint: use 'switch-tabs.ps1' to switch between the tabs automatically)"
|
|
exit 0 # success
|
|
} catch {
|
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
|
exit 1
|
|
}
|
|
```
|
|
|
|
*(generated by convert-ps2md.ps1 using the comment-based help of open-dashboards.ps1 as of 08/06/2023 21:36:14)*
|