From 6b2abf3103c0c12d395634825777ec0c38470c52 Mon Sep 17 00:00:00 2001 From: Markus Fleschutz <markus.fleschutz@gmail.com> Date: Fri, 22 Nov 2024 14:34:47 +0100 Subject: [PATCH] Updated write-typewriter.ps1 --- scripts/write-typewriter.ps1 | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/write-typewriter.ps1 b/scripts/write-typewriter.ps1 index 9320b410..f3004558 100755 --- a/scripts/write-typewriter.ps1 +++ b/scripts/write-typewriter.ps1 @@ -1,27 +1,27 @@ <# .SYNOPSIS - Writes text á la typewriter + Writes text like a typewriter .DESCRIPTION This PowerShell script writes the given text with the typewriter effect. .PARAMETER text - Specifies the text to write + Specifies the text to write (sample text by default) .PARAMETER speed - Specifies the speed (250 ms by default) + Specifies the speed (200 ms by default) .EXAMPLE - PS> ./write-typewriter "Hello World" + PS> ./write-typewriter.ps1 "Hello World" .LINK https://github.com/fleschutz/PowerShell .NOTES Author: Markus Fleschutz | License: CC0 #> -param([string]$text = "`nHello World`n-----------`n* PowerShell is powerful - fully control your computer`n* PowerShell is cross-platform - available for Linux, Mac OS and Windows`n* PowerShell is open-source and free`n* PowerShell is easy to learn`n* PowerShell is fully documented`n`nThanks for watching`nMarkus`n", [int]$speed = 200) # in milliseconds +param([string]$text = "Hello World, this is the PowerShell typewriter.", [int]$speed = 200) # in milliseconds try { $Random = New-Object System.Random $text -split '' | ForEach-Object { - Write-Host -noNewline $_ - Start-Sleep -milliseconds $(1 + $Random.Next($speed)) + Write-Host $_ -noNewline + Start-Sleep -milliseconds $Random.Next($speed) } Write-Host "" exit 0 # success