2021-08-26 10:46:12 +02:00
<#
2021-07-13 21:10:02 +02:00
. SYNOPSIS
write-marquee . ps1 [ < text > ] [ < speed > ]
. DESCRIPTION
2021-08-29 17:50:03 +02:00
Writes the given text as marquee .
2021-07-13 21:10:02 +02:00
. EXAMPLE
PS > . \ write-marquee . ps1 " Hello World "
2021-08-29 17:50:03 +02:00
. NOTES
Author : Markus Fleschutz · License : CC0
2021-07-13 21:10:02 +02:00
. LINK
https : / / github . com / fleschutz / PowerShell
2021-01-03 18:32:46 +01:00
#>
2021-07-15 15:51:22 +02:00
param ( [ string ] $Text = " PowerShell is powerful! PowerShell is cross-platform! PowerShell is open-source! PowerShell is easy to learn! Powershell is fully documented " , [ int ] $Speed = 60 ) # 60 ms pause
2021-01-03 18:32:46 +01:00
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 " "
}
2021-01-03 18:35:34 +01:00
StartMarquee " +++ $Text +++ $Text +++ $Text +++ $Text +++ $Text +++ $Text +++ $Text +++ $Text +++ $Text +++ $Text +++ $Text +++ $Text +++ "
2021-01-03 18:32:46 +01:00
exit 0