mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-30 03:43:50 +01:00
Update write-animated.ps1
This commit is contained in:
parent
938eac8a68
commit
8c9c31fcc3
@ -15,7 +15,7 @@ param($Line1 = "", $Line2 = "", $Line3 = "", $Line4 = "", $Line5 = "", $Line6 =
|
|||||||
|
|
||||||
$TerminalWidth = 120 # characters
|
$TerminalWidth = 120 # characters
|
||||||
|
|
||||||
function WriteLine { param([string]$Line, [int]$Speed)
|
function WriteLine { param([string]$Line)
|
||||||
[int]$Start = 1
|
[int]$Start = 1
|
||||||
[int]$End = $Line.Length
|
[int]$End = $Line.Length
|
||||||
$StartPosition = $HOST.UI.RawUI.CursorPosition
|
$StartPosition = $HOST.UI.RawUI.CursorPosition
|
||||||
@ -24,11 +24,11 @@ function WriteLine { param([string]$Line, [int]$Speed)
|
|||||||
if ($Line -eq "") { return }
|
if ($Line -eq "") { return }
|
||||||
foreach ($Pos in $Start .. $End) {
|
foreach ($Pos in $Start .. $End) {
|
||||||
$TextToDisplay = $Spaces.Substring(0, $TerminalWidth / 2 - $pos / 2) + $Line.Substring(0, $Pos)
|
$TextToDisplay = $Spaces.Substring(0, $TerminalWidth / 2 - $pos / 2) + $Line.Substring(0, $Pos)
|
||||||
write-host -nonewline $TextToDisplay
|
Write-Host $TextToDisplay -noNewline
|
||||||
start-sleep -milliseconds $Speed
|
Start-Sleep -milliseconds $Speed
|
||||||
$HOST.UI.RawUI.CursorPosition = $StartPosition
|
$HOST.UI.RawUI.CursorPosition = $StartPosition
|
||||||
}
|
}
|
||||||
write-host ""
|
Write-Host ""
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($Line1 -eq "") {
|
if ($Line1 -eq "") {
|
||||||
@ -40,13 +40,13 @@ if ($Line1 -eq "") {
|
|||||||
$Line6 = "Markus"
|
$Line6 = "Markus"
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteLine $Line1 $Speed
|
WriteLine $Line1
|
||||||
WriteLine $Line2 $Speed
|
WriteLine $Line2
|
||||||
WriteLine $Line3 $Speed
|
WriteLine $Line3
|
||||||
WriteLine $Line4 $Speed
|
WriteLine $Line4
|
||||||
WriteLine $Line5 $Speed
|
WriteLine $Line5
|
||||||
WriteLine $Line6 $Speed
|
WriteLine $Line6
|
||||||
WriteLine $Line7 $Speed
|
WriteLine $Line7
|
||||||
WriteLine $Line8 $Speed
|
WriteLine $Line8
|
||||||
WriteLine $Line9 $Speed
|
WriteLine $Line9
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
|
Loading…
Reference in New Issue
Block a user