diff --git a/Data/scripts.csv b/Data/scripts.csv index 7d073054..a0a61f2d 100644 --- a/Data/scripts.csv +++ b/Data/scripts.csv @@ -99,6 +99,7 @@ weather-alert.ps1, checks the current weather for critical values weather-report.ps1, prints the local weather report weather-worldwide.ps1, prints the current weather of cities worldwide wakeup.ps1, sends a magic packet to the given computer, waking him up +write-animated.ps1, writes animated text write-big.ps1, writes the given text in big letters write-blue.ps1, writes the given text in a blue foreground color write-braille.ps1, writes the given text in Braille diff --git a/README.md b/README.md index 7c68a0e3..76a5603d 100644 --- a/README.md +++ b/README.md @@ -107,6 +107,7 @@ The following PowerShell scripts can be found in the [Scripts/](Scripts/) subfol * [weather-report.ps1](Scripts/weather-report.ps1) - prints the local weather report * [weather-worldwide.ps1](Scripts/weather-worldwide.ps1) - prints the current weather of cities worldwide * [wakeup.ps1](Scripts/wakeup.ps1) - sends a magic packet to the given computer, waking him up +* [write-animated.ps1](Scripts/write-animated.ps1) - writes animated text * [write-big.ps1](Scripts/write-big.ps1) - writes the given text in big letters * [write-blue.ps1](Scripts/write-blue.ps1) - writes the given text in a blue foreground color * [write-braille.ps1](Scripts/write-braille.ps1) - writes the given text in Braille diff --git a/Scripts/write-animated.ps1 b/Scripts/write-animated.ps1 new file mode 100755 index 00000000..9061cc4e --- /dev/null +++ b/Scripts/write-animated.ps1 @@ -0,0 +1,46 @@ +#!/snap/bin/powershell +<# +.SYNTAX ./write-animated.ps1 [] .. [line9>] [] +.DESCRIPTION writes animated text +.LINK https://github.com/fleschutz/PowerShell +.NOTES Author: Markus Fleschutz / License: CC0 +#> + +param([string]$Line1 = "", [string]$Line2 = "", [string]$Line3 = "", [string]$Line4 = "", [string]$Line5 = "", [string]$Line6 = "", [string]$Line7 = "", [string]$Line8 = "", [string]$Line9 = "", [int]$Speed = 50) # 50 ms pause + +function WriteAnimatedLine { param([string]$Line, [int]$Speed) + [int]$Start = 1 + [int]$End = $Line.Length + $StartPosition = $HOST.UI.RawUI.CursorPosition + $Spaces = " " + + if ($Line -ne "") { + foreach ($Pos in $Start .. $End) { + $TextToDisplay = $Spaces.Substring(0, 40 - $pos / 2) + $Line.Substring(0, $Pos) + write-host -nonewline $TextToDisplay + start-sleep -milliseconds $Speed + $HOST.UI.RawUI.CursorPosition = $StartPosition + } + write-host "" + } +} + +if ($Line1 -eq "") { + $Line1 = "Welcome to PowerShell Scripts" + $Line2 = "" + $Line3 = "This repository contains useful and cross-platform PowerShell scripts." + $Line4 = "Send your e-mail feedback to: markus@fleschutz.de" + $Line5 = "Best regards," + $Line6 = "Markus" +} +write-host "" +WriteAnimatedLine $Line1 $Speed +WriteAnimatedLine $Line2 $Speed +WriteAnimatedLine $Line3 $Speed +WriteAnimatedLine $Line4 $Speed +WriteAnimatedLine $Line5 $Speed +WriteAnimatedLine $Line6 $Speed +WriteAnimatedLine $Line7 $Speed +WriteAnimatedLine $Line8 $Speed +WriteAnimatedLine $Line9 $Speed +exit 0 diff --git a/Scripts/write-marquee.ps1 b/Scripts/write-marquee.ps1 index 8ec3c455..19b96ccb 100755 --- a/Scripts/write-marquee.ps1 +++ b/Scripts/write-marquee.ps1 @@ -1,6 +1,6 @@ #!/snap/bin/powershell <# -.SYNTAX ./write-marquee.ps1 [] ] +.SYNTAX ./write-marquee.ps1 [] [] .DESCRIPTION writes the given text as marquee .LINK https://github.com/fleschutz/PowerShell .NOTES Author: Markus Fleschutz / License: CC0