Added simulate-typewriter.ps1

This commit is contained in:
Markus Fleschutz 2020-12-14 07:57:01 +00:00
parent 754a5c1899
commit 00085eb531
2 changed files with 23 additions and 0 deletions

View File

@ -35,6 +35,7 @@ The following PowerShell scripts can be found in the [Scripts/](Scripts/) subfol
* [SHA1.ps1](Scripts/SHA1.ps1) - prints the SHA1 checksum of the given file
* [SHA256.ps1](Scripts/SHA256.ps1) - prints the SHA256 checksum of the given file
* [simulate-presence.ps1](Scripts/simulate-presence.ps1) - simulates the human presence against burglars
* [simulate-typewriter.ps1](Scripts/simulate-typewriter.ps1) - prints a message with the typewriter effect
* [speak-file.ps1](Scripts/speak-file.ps1) - speaks the content of the given text file by text-to-speech (TTS)
* [speak-text.ps1](Scripts/speak-text.ps1) - speaks the given text by text-to-speech (TTS)
* [switch-shelly1.ps1](Scripts/switch-shelly1.ps1) - switches a Shelly1 device in the local network

22
Scripts/simulate-typewriter.ps1 Executable file
View File

@ -0,0 +1,22 @@
#!/snap/bin/powershell
# Syntax: ./simulate-typewriter.ps1 [<message>]
# Description: prints the given message with the typewriter effect
# Author: Markus Fleschutz
# Source: github.com/fleschutz/PowerShell
# License: CC0
param([string]$message)
if ($message -eq "" ) {
$message = "`nHello World`n-----------`nPowerShell is cross-platform`nPowerShell is open-source`nPowerShell is easy to learn`nPowerShell is fully documented`n`nThanks for watching`n`n:-)`n`n"
}
$Random = New-Object System.Random
$message -split '' |
ForEach-Object {
Write-Host $_ -nonew
Start-Sleep -milliseconds $(1 + $Random.Next(250))
}
exit 0