Updated simulate-typewriter.ps1

This commit is contained in:
Markus Fleschutz 2020-12-14 09:03:05 +00:00
parent f12aaf0575
commit 4b621987ba
2 changed files with 18 additions and 12 deletions

View File

@ -7,13 +7,14 @@
# License: CC0
param([string]$URL)
if ($URL -eq "" ) {
$URL = read-host "Enter URL to download"
}
try {
if ($URL -eq "" ) {
$URL = read-host "Enter URL to download"
}
wget --mirror --convert-links --adjust-extension --page-requisites --no-parent $URL --directory-prefix . --no-verbose
write-host "✔️ Done."
Write-Output "OK."
exit 0
} catch {
Write-Error "ERROR in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -10,14 +10,19 @@ 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"
}
$speed = 250
$Speed = 250
$Random = New-Object System.Random
try {
$Random = New-Object System.Random
$message -split '' |
ForEach-Object {
Write-Host -nonewline $_
Start-Sleep -milliseconds $(1 + $Random.Next($Speed))
}
$message -split '' |
ForEach-Object {
Write-Host -nonewline $_
Start-Sleep -milliseconds $(1 + $Random.Next($speed))
}
exit 0
exit 0
} catch {
Write-Error "ERROR in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}