Updated some play-* scripts

This commit is contained in:
Markus Fleschutz 2024-01-25 13:58:06 +01:00
parent e73e26f9e7
commit 66d6bc3d52
3 changed files with 200 additions and 181 deletions

View File

@ -4,29 +4,35 @@
.DESCRIPTION
This PowerShell script plays the Imperial March used in the Star Wars film series.
.EXAMPLE
PS> ./play-imperial-march
PS> ./play-imperial-march.ps1
(listen and enjoy)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
[System.Console]::beep(440, 500)
[System.Console]::beep(440, 500)
[System.Console]::beep(440, 500)
[System.Console]::beep(349, 350)
[System.Console]::beep(523, 150)
[System.Console]::beep(440, 500)
[System.Console]::beep(349, 350)
[System.Console]::beep(523, 150)
[System.Console]::beep(440, 1000)
[System.Console]::beep(659, 500)
[System.Console]::beep(659, 500)
[System.Console]::beep(659, 500)
[System.Console]::beep(698, 350)
[System.Console]::beep(523, 150)
[System.Console]::beep(415, 500)
[System.Console]::beep(349, 350)
[System.Console]::beep(523, 150)
[System.Console]::beep(440, 1000)
exit 0 # success
try {
[System.Console]::beep(440, 500)
[System.Console]::beep(440, 500)
[System.Console]::beep(440, 500)
[System.Console]::beep(349, 350)
[System.Console]::beep(523, 150)
[System.Console]::beep(440, 500)
[System.Console]::beep(349, 350)
[System.Console]::beep(523, 150)
[System.Console]::beep(440, 1000)
[System.Console]::beep(659, 500)
[System.Console]::beep(659, 500)
[System.Console]::beep(659, 500)
[System.Console]::beep(698, 350)
[System.Console]::beep(523, 150)
[System.Console]::beep(415, 500)
[System.Console]::beep(349, 350)
[System.Console]::beep(523, 150)
[System.Console]::beep(440, 1000)
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}

View File

@ -4,7 +4,8 @@
.DESCRIPTION
This PowerShell script plays the famous Jingle Bells song.
.EXAMPLE
PS> ./play-jingle-bells
PS> ./play-jingle-bells.ps1
(listen and enjoy)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -46,115 +47,121 @@ $Duration = New-Object -TypeName psobject -Property @{
EIGHTH = 200
SIXTEENTH = 100
}
[System.Console]::Beep($Notes.C, $Duration.EIGHTH )
[System.Console]::Beep($Notes.C, $Duration.EIGHTH )
[System.Console]::Beep($Notes.C, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.G, $Duration.QUARTER)
[System.Console]::Beep($Notes.F, $Duration.QUARTER)
[System.Console]::Beep($Notes.C, $Duration.HALF )
[System.Console]::Beep($Notes.C, $Duration.EIGHTH )
[System.Console]::Beep($Notes.C, $Duration.EIGHTH )
[System.Console]::Beep($Notes.C, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.G, $Duration.QUARTER)
[System.Console]::Beep($Notes.F, $Duration.QUARTER)
[System.Console]::Beep($Notes.D, $Duration.HALF )
Start-Sleep -m $Duration.EIGHTH
[System.Console]::Beep($Notes.D, $Duration.EIGHTH )
[System.Console]::Beep($Notes.E, $Duration.QUARTER)
[System.Console]::Beep($Notes.BB, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.G, $Duration.QUARTER)
[System.Console]::Beep($Notes.E, $Duration.HALF)
Start-Sleep -m $Duration.EIGHTH
[System.Console]::Beep($Notes.E, $Duration.EIGHTH)
[System.Console]::Beep($Notes.CC, $Duration.QUARTER)
[System.Console]::Beep($Notes.CC, $Duration.QUARTER)
[System.Console]::Beep($Notes.BB, $Duration.QUARTER)
[System.Console]::Beep($Notes.G, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.HALF)
[System.Console]::Beep($Notes.C, $Duration.EIGHTH )
[System.Console]::Beep($Notes.C, $Duration.EIGHTH )
[System.Console]::Beep($Notes.C, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.G, $Duration.QUARTER)
[System.Console]::Beep($Notes.F, $Duration.QUARTER)
[System.Console]::Beep($Notes.C, $Duration.HALF )
[System.Console]::Beep($Notes.C, $Duration.EIGHTH )
[System.Console]::Beep($Notes.C, $Duration.EIGHTH )
[System.Console]::Beep($Notes.C, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.G, $Duration.QUARTER)
[System.Console]::Beep($Notes.F, $Duration.QUARTER)
[System.Console]::Beep($Notes.D, $Duration.HALF )
Start-Sleep -m $Duration.QUARTER
[System.Console]::Beep($Notes.D, $Duration.EIGHTH )
[System.Console]::Beep($Notes.E, $Duration.QUARTER)
[System.Console]::Beep($Notes.BB, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.G, $Duration.QUARTER)
[System.Console]::Beep($Notes.CC, $Duration.QUARTER)
[System.Console]::Beep($Notes.CC, $Duration.QUARTER)
[System.Console]::Beep($Notes.CC, $Duration.QUARTER)
[System.Console]::Beep($Notes.CC, $Duration.EIGHTH)
[System.Console]::Beep($Notes.DD, $Duration.QUARTER)
[System.Console]::Beep($Notes.CC, $Duration.QUARTER)
[System.Console]::Beep($Notes.BB, $Duration.QUARTER)
[System.Console]::Beep($Notes.G, $Duration.QUARTER)
[System.Console]::Beep($Notes.F, $Duration.HALF)
[System.Console]::Beep($Notes.CC, $Duration.HALF)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.HALF)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.HALF)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.CC, $Duration.QUARTER)
[System.Console]::Beep($Notes.F, $Duration.QUARTER)
[System.Console]::Beep($Notes.G, $Duration.EIGHTH)
[System.Console]::Beep($Notes.AA, $Duration.HALF)
Start-Sleep -m $Duration.EIGHTH
[System.Console]::Beep($Notes.BB, $Duration.QUARTER)
[System.Console]::Beep($Notes.BB, $Duration.QUARTER)
[System.Console]::Beep($Notes.BB, $Duration.QUARTER)
[System.Console]::Beep($Notes.BB, $Duration.EIGHTH)
[System.Console]::Beep($Notes.BB, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.EIGHTH)
[System.Console]::Beep($Notes.AA, $Duration.EIGHTH)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.G, $Duration.QUARTER)
[System.Console]::Beep($Notes.G, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.G, $Duration.HALF)
[System.Console]::Beep($Notes.CC, $Duration.HALF)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.HALF)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.HALF)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.CC, $Duration.QUARTER)
[System.Console]::Beep($Notes.F, $Duration.QUARTER)
[System.Console]::Beep($Notes.G, $Duration.EIGHTH)
[System.Console]::Beep($Notes.AA, $Duration.HALF)
Start-Sleep -m $Duration.EIGHTH
[System.Console]::Beep($Notes.CC, $Duration.QUARTER)
[System.Console]::Beep($Notes.CC, $Duration.QUARTER)
[System.Console]::Beep($Notes.CC, $Duration.QUARTER)
[System.Console]::Beep($Notes.CC, $Duration.EIGHTH)
[System.Console]::Beep($Notes.CC, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.EIGHTH)
[System.Console]::Beep($Notes.AA, $Duration.EIGHTH)
[System.Console]::Beep($Notes.CC, $Duration.QUARTER)
[System.Console]::Beep($Notes.CC, $Duration.QUARTER)
[System.Console]::Beep($Notes.BB, $Duration.QUARTER)
[System.Console]::Beep($Notes.G, $Duration.QUARTER)
[System.Console]::Beep($Notes.F, $Duration.HALF)
exit 0 # success
try {
[System.Console]::Beep($Notes.C, $Duration.EIGHTH )
[System.Console]::Beep($Notes.C, $Duration.EIGHTH )
[System.Console]::Beep($Notes.C, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.G, $Duration.QUARTER)
[System.Console]::Beep($Notes.F, $Duration.QUARTER)
[System.Console]::Beep($Notes.C, $Duration.HALF )
[System.Console]::Beep($Notes.C, $Duration.EIGHTH )
[System.Console]::Beep($Notes.C, $Duration.EIGHTH )
[System.Console]::Beep($Notes.C, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.G, $Duration.QUARTER)
[System.Console]::Beep($Notes.F, $Duration.QUARTER)
[System.Console]::Beep($Notes.D, $Duration.HALF )
Start-Sleep -m $Duration.EIGHTH
[System.Console]::Beep($Notes.D, $Duration.EIGHTH )
[System.Console]::Beep($Notes.E, $Duration.QUARTER)
[System.Console]::Beep($Notes.BB, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.G, $Duration.QUARTER)
[System.Console]::Beep($Notes.E, $Duration.HALF)
Start-Sleep -m $Duration.EIGHTH
[System.Console]::Beep($Notes.E, $Duration.EIGHTH)
[System.Console]::Beep($Notes.CC, $Duration.QUARTER)
[System.Console]::Beep($Notes.CC, $Duration.QUARTER)
[System.Console]::Beep($Notes.BB, $Duration.QUARTER)
[System.Console]::Beep($Notes.G, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.HALF)
[System.Console]::Beep($Notes.C, $Duration.EIGHTH )
[System.Console]::Beep($Notes.C, $Duration.EIGHTH )
[System.Console]::Beep($Notes.C, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.G, $Duration.QUARTER)
[System.Console]::Beep($Notes.F, $Duration.QUARTER)
[System.Console]::Beep($Notes.C, $Duration.HALF )
[System.Console]::Beep($Notes.C, $Duration.EIGHTH )
[System.Console]::Beep($Notes.C, $Duration.EIGHTH )
[System.Console]::Beep($Notes.C, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.G, $Duration.QUARTER)
[System.Console]::Beep($Notes.F, $Duration.QUARTER)
[System.Console]::Beep($Notes.D, $Duration.HALF )
Start-Sleep -m $Duration.QUARTER
[System.Console]::Beep($Notes.D, $Duration.EIGHTH )
[System.Console]::Beep($Notes.E, $Duration.QUARTER)
[System.Console]::Beep($Notes.BB, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.G, $Duration.QUARTER)
[System.Console]::Beep($Notes.CC, $Duration.QUARTER)
[System.Console]::Beep($Notes.CC, $Duration.QUARTER)
[System.Console]::Beep($Notes.CC, $Duration.QUARTER)
[System.Console]::Beep($Notes.CC, $Duration.EIGHTH)
[System.Console]::Beep($Notes.DD, $Duration.QUARTER)
[System.Console]::Beep($Notes.CC, $Duration.QUARTER)
[System.Console]::Beep($Notes.BB, $Duration.QUARTER)
[System.Console]::Beep($Notes.G, $Duration.QUARTER)
[System.Console]::Beep($Notes.F, $Duration.HALF)
[System.Console]::Beep($Notes.CC, $Duration.HALF)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.HALF)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.HALF)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.CC, $Duration.QUARTER)
[System.Console]::Beep($Notes.F, $Duration.QUARTER)
[System.Console]::Beep($Notes.G, $Duration.EIGHTH)
[System.Console]::Beep($Notes.AA, $Duration.HALF)
Start-Sleep -m $Duration.EIGHTH
[System.Console]::Beep($Notes.BB, $Duration.QUARTER)
[System.Console]::Beep($Notes.BB, $Duration.QUARTER)
[System.Console]::Beep($Notes.BB, $Duration.QUARTER)
[System.Console]::Beep($Notes.BB, $Duration.EIGHTH)
[System.Console]::Beep($Notes.BB, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.EIGHTH)
[System.Console]::Beep($Notes.AA, $Duration.EIGHTH)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.G, $Duration.QUARTER)
[System.Console]::Beep($Notes.G, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.G, $Duration.HALF)
[System.Console]::Beep($Notes.CC, $Duration.HALF)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.HALF)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.HALF)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.CC, $Duration.QUARTER)
[System.Console]::Beep($Notes.F, $Duration.QUARTER)
[System.Console]::Beep($Notes.G, $Duration.EIGHTH)
[System.Console]::Beep($Notes.AA, $Duration.HALF)
Start-Sleep -m $Duration.EIGHTH
[System.Console]::Beep($Notes.CC, $Duration.QUARTER)
[System.Console]::Beep($Notes.CC, $Duration.QUARTER)
[System.Console]::Beep($Notes.CC, $Duration.QUARTER)
[System.Console]::Beep($Notes.CC, $Duration.EIGHTH)
[System.Console]::Beep($Notes.CC, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
[System.Console]::Beep($Notes.AA, $Duration.EIGHTH)
[System.Console]::Beep($Notes.AA, $Duration.EIGHTH)
[System.Console]::Beep($Notes.CC, $Duration.QUARTER)
[System.Console]::Beep($Notes.CC, $Duration.QUARTER)
[System.Console]::Beep($Notes.BB, $Duration.QUARTER)
[System.Console]::Beep($Notes.G, $Duration.QUARTER)
[System.Console]::Beep($Notes.F, $Duration.HALF)
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}

View File

@ -4,57 +4,63 @@
.DESCRIPTION
This PowerShell script plays the Mission Impossible theme.
.EXAMPLE
PS> ./play-mission-impossible
PS> ./play-mission-impossible.ps1
(listen and enjoy)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
[System.Console]::Beep(784,150)
Start-Sleep -m 300
[System.Console]::Beep(784,150)
Start-Sleep -m 300
[System.Console]::Beep(932,150)
Start-Sleep -m 150
[System.Console]::Beep(1047,150)
Start-Sleep -m 150
[System.Console]::Beep(784,150)
Start-Sleep -m 300
[System.Console]::Beep(784,150)
Start-Sleep -m 300
[console]::Beep(699,150)
Start-Sleep -m 150
[System.Console]::Beep(740,150)
Start-Sleep -m 150
[System.Console]::Beep(784,150)
Start-Sleep -m 300
[System.Console]::Beep(784,150)
Start-Sleep -m 300
[System.Console]::Beep(932,150)
Start-Sleep -m 150
[System.Console]::Beep(1047,150)
Start-Sleep -m 150
[System.Console]::Beep(784,150)
Start-Sleep -m 300
[System.Console]::Beep(784,150)
Start-Sleep -m 300
[System.Console]::Beep(699,150)
Start-Sleep -m 150
[System.Console]::Beep(740,150)
Start-Sleep -m 150
[System.Console]::Beep(932,150)
[System.Console]::Beep(784,150)
[System.Console]::Beep(587,1200)
Start-Sleep -m 75
[System.Console]::Beep(932,150)
[System.Console]::Beep(784,150)
[System.Console]::Beep(554,1200)
Start-Sleep -m 75
[System.Console]::Beep(932,150)
[System.Console]::Beep(784,150)
[System.Console]::Beep(523,1200)
Start-Sleep -m 150
[System.Console]::Beep(466,150)
[System.Console]::Beep(523,150)
exit 0 # success
try {
[System.Console]::Beep(784,150)
Start-Sleep -m 300
[System.Console]::Beep(784,150)
Start-Sleep -m 300
[System.Console]::Beep(932,150)
Start-Sleep -m 150
[System.Console]::Beep(1047,150)
Start-Sleep -m 150
[System.Console]::Beep(784,150)
Start-Sleep -m 300
[System.Console]::Beep(784,150)
Start-Sleep -m 300
[console]::Beep(699,150)
Start-Sleep -m 150
[System.Console]::Beep(740,150)
Start-Sleep -m 150
[System.Console]::Beep(784,150)
Start-Sleep -m 300
[System.Console]::Beep(784,150)
Start-Sleep -m 300
[System.Console]::Beep(932,150)
Start-Sleep -m 150
[System.Console]::Beep(1047,150)
Start-Sleep -m 150
[System.Console]::Beep(784,150)
Start-Sleep -m 300
[System.Console]::Beep(784,150)
Start-Sleep -m 300
[System.Console]::Beep(699,150)
Start-Sleep -m 150
[System.Console]::Beep(740,150)
Start-Sleep -m 150
[System.Console]::Beep(932,150)
[System.Console]::Beep(784,150)
[System.Console]::Beep(587,1200)
Start-Sleep -m 75
[System.Console]::Beep(932,150)
[System.Console]::Beep(784,150)
[System.Console]::Beep(554,1200)
Start-Sleep -m 75
[System.Console]::Beep(932,150)
[System.Console]::Beep(784,150)
[System.Console]::Beep(523,1200)
Start-Sleep -m 150
[System.Console]::Beep(466,150)
[System.Console]::Beep(523,150)
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}