PowerShell/scripts/write-marquee.ps1

38 lines
2.1 KiB
PowerShell
Raw Normal View History

2023-10-31 13:03:45 +01: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-10-03 11:43:42 +02:00
This PowerShell script writes the given 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
#>
2022-10-03 11:43:42 +02:00
param([string]$Text = "PowerShell is powerful - fully control your computer! PowerShell is cross-platform - available for Linux, Mac OS and Windows! PowerShell is open-source and free - see the GitHub repository at github.com/PowerShell/PowerShell! PowerShell is easy to learn - see the tutorial for beginners at guru99.com/powershell-tutorial.html! Powershell is fully documented - see the official PowerShell documentation at docs.microsoft.com/en-us/powershell", [int]$Speed = 60) # 60 ms pause
2021-01-03 18:32:46 +01:00
2022-10-03 11:43:42 +02:00
function StartMarquee { param([string]$Line)
"╔══════════════════════════════════════════════════════════════════════════════════╗"
"║ ║"
"╚══════════════════════════════════════════════════════════════════════════════════╝"
$LinePos = $HOST.UI.RawUI.CursorPosition
$LinePos.X = 2
$LinePos.Y -= 2
foreach($Pos in 1 .. $($Line.Length - 80)) {
$HOST.UI.RawUI.CursorPosition = $LinePos
Write-Host -noNewLine "$($Line.Substring($Pos,80))"
Start-Sleep -milliseconds $Speed
2021-01-03 18:32:46 +01:00
}
2022-10-03 11:43:42 +02:00
" "
" "
" "
2021-01-03 18:32:46 +01:00
}
2022-10-03 11:43:42 +02:00
StartMarquee " +++ $Text +++ $Text +++ $Text +++ $Text +++ $Text +++ $Text +++ $Text +++ $Text +++ $Text +++ $Text +++ $Text +++ $Text +++ "
exit 0 # success