From e73e26f9e798033359d8a41c6adc36d0bf3865a9 Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Thu, 25 Jan 2024 13:52:52 +0100 Subject: [PATCH] Update play-happy-birthday.ps1 --- scripts/play-happy-birthday.ps1 | 60 ++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/scripts/play-happy-birthday.ps1 b/scripts/play-happy-birthday.ps1 index 3069e45c..a604986d 100755 --- a/scripts/play-happy-birthday.ps1 +++ b/scripts/play-happy-birthday.ps1 @@ -4,36 +4,42 @@ .DESCRIPTION This PowerShell script plays the famous Happy Birthday song. .EXAMPLE - PS> ./play-happy-birthday + PS> ./play-happy-birthday.ps1 + (listen and enjoy) .LINK https://github.com/fleschutz/PowerShell .NOTES Author: Markus Fleschutz | License: CC0 #> -[System.Console]::Beep(1059.274, 300) -[System.Console]::Beep(1059.274, 200) -[System.Console]::Beep(1188.995, 500) -[System.Console]::Beep(1059.274, 500) -[System.Console]::Beep(1413.961, 500) -[System.Console]::Beep(1334.601, 950) -[System.Console]::Beep(1059.274, 300) -[System.Console]::Beep(1059.274, 200) -[System.Console]::Beep(1188.995, 500) -[System.Console]::Beep(1059.274, 500) -[System.Console]::Beep(1587.117, 500) -[System.Console]::Beep(1413.961, 950) -[System.Console]::Beep(1059.274, 300) -[System.Console]::Beep(1059.274, 200) -[System.Console]::Beep(2118.547, 500) -[System.Console]::Beep(1781.479, 500) -[System.Console]::Beep(1413.961, 500) -[System.Console]::Beep(1334.601, 500) -[System.Console]::Beep(1188.995, 500) -[System.Console]::Beep(1887.411, 300) -[System.Console]::Beep(1887.411, 200) -[System.Console]::Beep(1781.479, 500) -[System.Console]::Beep(1413.961, 500) -[System.Console]::Beep(1587.117, 500) -[System.Console]::Beep(1413.961, 900) -exit 0 # success +try { + [System.Console]::Beep(1059.274, 300) + [System.Console]::Beep(1059.274, 200) + [System.Console]::Beep(1188.995, 500) + [System.Console]::Beep(1059.274, 500) + [System.Console]::Beep(1413.961, 500) + [System.Console]::Beep(1334.601, 950) + [System.Console]::Beep(1059.274, 300) + [System.Console]::Beep(1059.274, 200) + [System.Console]::Beep(1188.995, 500) + [System.Console]::Beep(1059.274, 500) + [System.Console]::Beep(1587.117, 500) + [System.Console]::Beep(1413.961, 950) + [System.Console]::Beep(1059.274, 300) + [System.Console]::Beep(1059.274, 200) + [System.Console]::Beep(2118.547, 500) + [System.Console]::Beep(1781.479, 500) + [System.Console]::Beep(1413.961, 500) + [System.Console]::Beep(1334.601, 500) + [System.Console]::Beep(1188.995, 500) + [System.Console]::Beep(1887.411, 300) + [System.Console]::Beep(1887.411, 200) + [System.Console]::Beep(1781.479, 500) + [System.Console]::Beep(1413.961, 500) + [System.Console]::Beep(1587.117, 500) + [System.Console]::Beep(1413.961, 900) + exit 0 # success +} catch { + "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" + exit 1 +}