PowerShell/Docs/write-marquee.md

87 lines
3.7 KiB
Markdown
Raw Normal View History

2022-11-17 20:11:37 +01:00
## The PowerShell Script **write-marquee.ps1**
2021-11-08 21:36:42 +01:00
2022-11-17 19:46:02 +01:00
This PowerShell script writes the given text as marquee.
2021-11-08 21:36:42 +01:00
## Parameters
```powershell
2022-11-17 19:46:02 +01:00
write-marquee.ps1 [[-Text] <String>] [[-Speed] <Int32>] [<CommonParameters>]
2021-11-08 21:36:42 +01:00
2022-11-17 19:46:02 +01:00
-Text <String>
2021-11-08 21:36:42 +01:00
Specifies the text to write
Required? false
Position? 1
2022-11-17 19:46:02 +01:00
Default value 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
2021-11-08 21:36:42 +01:00
Accept pipeline input? false
Accept wildcard characters? false
2022-11-17 19:46:02 +01:00
-Speed <Int32>
2021-11-08 21:36:42 +01:00
Specifies the marquee speed (60 ms per default)
Required? false
Position? 2
Default value 60
Accept pipeline input? false
Accept wildcard characters? false
[<CommonParameters>]
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
```
## Example
```powershell
PS> ./write-marquee "Hello World"
```
## Notes
2022-11-17 19:46:02 +01:00
Author: Markus Fleschutz | License: CC0
2021-11-08 21:36:42 +01:00
## Related Links
https://github.com/fleschutz/PowerShell
2022-11-17 20:02:26 +01:00
## Source Code
2022-11-17 20:05:34 +01:00
```powershell
2022-11-17 20:02:26 +01:00
<#
.SYNOPSIS
Writes text as marquee
.DESCRIPTION
This PowerShell script writes the given text as marquee.
.PARAMETER text
Specifies the text to write
.PARAMETER speed
Specifies the marquee speed (60 ms per default)
.EXAMPLE
PS> ./write-marquee "Hello World"
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
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
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
}
" "
" "
" "
}
StartMarquee " +++ $Text +++ $Text +++ $Text +++ $Text +++ $Text +++ $Text +++ $Text +++ $Text +++ $Text +++ $Text +++ $Text +++ $Text +++ "
exit 0 # success
2022-11-17 20:05:34 +01:00
```
2022-11-17 20:02:26 +01:00
2021-11-08 21:36:42 +01:00
*Generated by convert-ps2md.ps1 using the comment-based help of write-marquee.ps1*