diff --git a/README.md b/README.md index 8ae90c9a..ed041117 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/Scripts/simulate-typewriter.ps1 b/Scripts/simulate-typewriter.ps1 new file mode 100755 index 00000000..00ddd034 --- /dev/null +++ b/Scripts/simulate-typewriter.ps1 @@ -0,0 +1,22 @@ +#!/snap/bin/powershell + +# Syntax: ./simulate-typewriter.ps1 [] +# 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