From 08b1bf2392e237b47c71270f4a1c53fff2f94f84 Mon Sep 17 00:00:00 2001 From: Tomasz Kostrzewa Date: Tue, 5 Mar 2024 17:18:52 +0100 Subject: [PATCH] new file: SimulateTyping/New-SimulateTyping.ps1 --- SimulateTyping/New-SimulateTyping.ps1 | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 SimulateTyping/New-SimulateTyping.ps1 diff --git a/SimulateTyping/New-SimulateTyping.ps1 b/SimulateTyping/New-SimulateTyping.ps1 new file mode 100644 index 0000000..ee1eeda --- /dev/null +++ b/SimulateTyping/New-SimulateTyping.ps1 @@ -0,0 +1,21 @@ +# gitea.RdzeN.net +# Simulate Typing +function New-SimulateTyping { +param( +[string]$message +) + +# Iterate through each character in the text +foreach ($char in $message.ToCharArray()) { + # Write each character to the screen + Write-Host -NoNewline $char -ForegroundColor Yellow + # Wait before writing the next character (adjustable time in milliseconds) + Start-Sleep -Milliseconds (Get-Random -Minimum 10 -Maximum 100) +} + # New line after last char. + Write-Host "" +} + +# Example usage of the function +New-SimulateTyping "This is an example text for typing simulation. +Multiline #1`nMultiline #2" \ No newline at end of file