PowerShell/docs/write-marquee.md

93 lines
3.7 KiB
Markdown
Raw Normal View History

2024-11-08 12:38:20 +01:00
The *write-marquee.ps1* Script
===========================
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
2023-07-29 10:04:38 +02:00
Parameters
----------
2021-11-08 21:36:42 +01:00
```powershell
2024-11-08 12:35:11 +01:00
/home/markus/Repos/PowerShell/scripts/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.
```
2023-07-29 10:04:38 +02:00
Example
-------
2021-11-08 21:36:42 +01:00
```powershell
PS> ./write-marquee "Hello World"
```
2023-07-29 10:04:38 +02:00
Notes
-----
2022-11-17 19:46:02 +01:00
Author: Markus Fleschutz | License: CC0
2021-11-08 21:36:42 +01:00
2023-07-29 10:04:38 +02:00
Related Links
-------------
2021-11-08 21:36:42 +01:00
https://github.com/fleschutz/PowerShell
2023-07-29 10:04:38 +02:00
Script Content
--------------
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
2024-11-20 11:52:20 +01:00
*(generated by convert-ps2md.ps1 as of 11/20/2024 11:52:02)*