Added write-marquee.ps1

This commit is contained in:
Markus Fleschutz 2021-01-03 18:32:46 +01:00
parent 31e0dfe88f
commit bcc5cc6df6
3 changed files with 41 additions and 0 deletions

View File

@ -84,6 +84,7 @@ write-blue.ps1, writes the given text in a blue foreground color
write-braille.ps1, writes the given text in Braille
write-green.ps1, writes the given text in a green foreground color
write-logbook.ps1, writes the given text to the logbook
write-marquee.ps1, writes the given text as marquee
write-morse-code.ps1, writes the given text in Morse code
write-motd.ps1, writes the message of the day (MOTD)
write-red.ps1, writes the given text in a red foreground color

Can't render this file because it has a wrong number of fields in line 81.

View File

@ -92,6 +92,7 @@ The following PowerShell scripts can be found in the [Scripts/](Scripts/) subfol
* [write-braille.ps1](Scripts/write-braille.ps1) - writes the given text in Braille
* [write-green.ps1](Scripts/write-green.ps1) - writes the given text in a green foreground color
* [write-logbook.ps1](Scripts/write-logbook.ps1) - writes the given text to the logbook
* [write-marquee.ps1](Scripts/write-marquee.ps1) - writes the given text as marquee
* [write-morse-code.ps1](Scripts/write-morse-code.ps1) - writes the given text in Morse code
* [write-motd.ps1](Scripts/write-motd.ps1) - writes the message of the day (MOTD)
* [write-red.ps1](Scripts/write-red.ps1) - writes the given text in a red foreground color

39
Scripts/write-marquee.ps1 Normal file
View File

@ -0,0 +1,39 @@
#!/snap/bin/powershell
<#
.SYNTAX ./write-marquee.ps1 [<text>] <speed>]
.DESCRIPTION writes the given text as marquee
.LINK https://github.com/fleschutz/PowerShell
.NOTES Author: Markus Fleschutz / License: CC0
#>
param([string]$Text = "", [int]$Speed = 60) # 60 ms pause
if ($Text -eq "") {
$Text = "PowerShell is powerful! PowerShell is cross-platform! PowerShell is open-source! PowerShell is easy to learn! Powershell is fully documented"
}
function StartMarquee { param([string]$text)
$Length = $text.Length
$Start = 1
$End = ($Length - 80)
clear-host
write-output ""
write-output "------------------------------------------------------------------------------------"
$StartPosition = $HOST.UI.RawUI.CursorPosition
$StartPosition.X = 2
write-output "| |"
write-output "------------------------------------------------------------------------------------"
foreach ($Pos in $Start .. $End) {
$HOST.UI.RawUI.CursorPosition = $StartPosition
$TextToDisplay = $text.Substring($Pos, 80)
write-host -nonewline $TextToDisplay
start-sleep -milliseconds $Speed
}
write-output ""
write-output ""
write-output ""
}
StartMarquee " +++ $Text +++ $Text +++ $Text +++ $Text +++ $Text +++ $Text +++ $Text +++ $Text +++ $Text +++ $Text +++ $Text +++ $Text"
exit 0