mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-09 05:04:39 +02:00
Added write-marquee.ps1
This commit is contained in:
39
Scripts/write-marquee.ps1
Normal file
39
Scripts/write-marquee.ps1
Normal 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
|
Reference in New Issue
Block a user