2021-09-27 10:38:12 +02:00
<#
2021-07-13 21:10:02 +02:00
. SYNOPSIS
2021-10-04 21:29:23 +02:00
Writes text as marquee
2021-07-13 21:10:02 +02:00
. DESCRIPTION
2022-01-30 10:49:30 +01:00
This PowerShell script writes text as marquee .
2021-10-16 16:50:10 +02:00
. PARAMETER text
Specifies the text to write
. PARAMETER speed
Specifies the marquee speed ( 60 ms per default )
2021-07-13 21:10:02 +02:00
. EXAMPLE
2021-09-25 19:43:22 +02:00
PS > . / write-marquee " Hello World "
2021-07-13 21:10:02 +02:00
. LINK
https : / / github . com / fleschutz / PowerShell
2022-09-06 21:42:04 +02:00
. NOTES
Author : Markus Fleschutz | License : CC0
2021-01-03 18:32:46 +01:00
#>
2021-09-25 19:43: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
2021-09-25 19:43:22 +02:00
start-sleep -milliseconds $speed
2021-01-03 18:32:46 +01:00
}
write-output " "
write-output " "
write-output " "
}
2021-09-25 19:43:22 +02:00
StartMarquee " +++ $text +++ $text +++ $text +++ $text +++ $text +++ $text +++ $text +++ $text +++ $text +++ $text +++ $text +++ $text +++ "
2021-09-27 10:09:45 +02:00
exit 0 # success