PowerShell/docs/speak-countdown.md

74 lines
1.7 KiB
Markdown
Raw Normal View History

2024-01-25 13:37:12 +01:00
Script: *speak-countdown.ps1*
========================
2021-11-08 21:36:42 +01:00
2022-11-17 19:46:02 +01:00
This PowerShell script speaks a countdown by text-to-speech (TTS) starting from a given number.
2021-11-08 21:36:42 +01:00
2023-07-29 10:04:38 +02:00
Parameters
----------
2021-11-08 21:36:42 +01:00
```powershell
2023-07-29 10:15:44 +02:00
PS> ./speak-countdown.ps1 [[-StartNumber] <Int32>] [<CommonParameters>]
2021-11-08 21:36:42 +01:00
-StartNumber <Int32>
2022-11-17 19:46:02 +01:00
Specifies the number to start from (10 by default)
2021-11-08 21:36:42 +01:00
Required? false
Position? 1
Default value 10
Accept pipeline input? false
Accept wildcard characters? false
[<CommonParameters>]
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
```
2023-07-29 10:04:38 +02:00
Example
-------
2021-11-08 21:36:42 +01:00
```powershell
2023-08-06 11:42:46 +02:00
PS> ./speak-countdown.ps1 60
2021-11-08 21:36:42 +01:00
```
2023-07-29 10:04:38 +02:00
Notes
-----
2022-11-17 19:46:02 +01:00
Author: Markus Fleschutz | License: CC0
2021-11-08 21:36:42 +01:00
2023-07-29 10:04:38 +02:00
Related Links
-------------
2021-11-08 21:36:42 +01:00
https://github.com/fleschutz/PowerShell
2023-07-29 10:04:38 +02:00
Script Content
--------------
2022-11-17 20:05:34 +01:00
```powershell
2022-11-17 20:02:26 +01:00
<#
.SYNOPSIS
Speaks a countdown by text-to-speech
.DESCRIPTION
This PowerShell script speaks a countdown by text-to-speech (TTS) starting from a given number.
.PARAMETER StartNumber
Specifies the number to start from (10 by default)
.EXAMPLE
2023-08-06 11:42:46 +02:00
PS> ./speak-countdown.ps1 60
2022-11-17 20:02:26 +01:00
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
param([int]$StartNumber = 10)
try {
for ([int]$i = $StartNumber; $i -gt 0; $i--) {
2022-11-18 17:02:20 +01:00
& "$PSScriptRoot/speak-english.ps1" $i
2023-05-26 12:20:18 +02:00
Start-Sleep -milliseconds 200
2022-11-17 20:02:26 +01:00
}
2022-11-18 17:02:20 +01:00
& "$PSScriptRoot/speak-english.ps1" "zero"
2022-11-17 20:02:26 +01:00
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}
2022-11-17 20:05:34 +01:00
```
2022-11-17 20:02:26 +01:00
2024-08-15 09:51:46 +02:00
*(generated by convert-ps2md.ps1 using the comment-based help of speak-countdown.ps1 as of 08/15/2024 09:50:54)*