From 7f44875321b2342f29fca2fe15d43338faa551c0 Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Fri, 18 Dec 2020 15:32:03 +0000 Subject: [PATCH] Added write-big.ps1 --- README.md | 1 + Scripts/write-big.ps1 | 96 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100755 Scripts/write-big.ps1 diff --git a/README.md b/README.md index ee8108c0..e1285fae 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,7 @@ The following PowerShell scripts can be found in the [Scripts/](Scripts/) subfol * [weather-report.ps1](Scripts/weather-report.ps1) - prints the local weather report * [weather-worldwide.ps1](Scripts/weather-worldwide.ps1) - prints the current weather of cities worldwide * [wakeup.ps1](Scripts/wakeup.ps1) - sends a magic packet to the given computer, waking him up +* [write-big.ps1](Scripts/write-big.ps1) - writes the given text in big letters * [write-blue.ps1](Scripts/write-blue.ps1) - writes the given text in blue * [write-green.ps1](Scripts/write-green.ps1) - writes the given text in green * [write-red.ps1](Scripts/write-red.ps1) - writes the given text in red diff --git a/Scripts/write-big.ps1 b/Scripts/write-big.ps1 new file mode 100755 index 00000000..28bb2384 --- /dev/null +++ b/Scripts/write-big.ps1 @@ -0,0 +1,96 @@ +#!/snap/bin/powershell + +# Syntax: ./write-big.ps1 [] +# Description: writes the given text in big letters +# Author: Markus Fleschutz +# Source: github.com/fleschutz/PowerShell +# License: CC0 + +param([String]$Text) + +function big_A() { + param([Int]$Line) + switch($Line) { + 0 { return " A " } + 1 { return " A A " } + 2 { return " A A " } + 3 { return " AAAAAAA " } + 4 { return " AAAAAAAAA " } + 5 { return "AA AA " } + } +} + +function big_B() { + param([Int]$Line) + switch($Line) { + 0 { return "BBBBBBB " } + 1 { return "B B " } + 2 { return "BBBBBBB " } + 3 { return "BBBBBBB " } + 4 { return "B B " } + 5 { return "BBBBBBB " } + } +} + +function big_char() { + param([String]$Char, [Int]$Line) + switch($Char) { + 'A' { return big_A $Line } + 'B' { return big_B $Line } + 'C' { return big_A $Line } + 'D' { return big_A $Line } + 'E' { return big_A $Line } + 'F' { return big_A $Line } + 'G' { return big_A $Line } + 'H' { return big_A $Line } + 'I' { return big_A $Line } + 'J' { return big_A $Line } + 'K' { return big_A $Line } + 'L' { return big_A $Line } + 'M' { return big_A $Line } + 'N' { return big_A $Line } + 'O' { return big_A $Line } + 'P' { return big_A $Line } + 'Q' { return big_A $Line } + 'R' { return big_A $Line } + 'S' { return big_A $Line } + 'T' { return big_A $Line } + 'U' { return big_A $Line } + 'V' { return big_A $Line } + 'W' { return big_A $Line } + 'X' { return big_A $Line } + 'Y' { return big_A $Line } + 'Z' { return big_A $Line } + '0' { return big_A $Line } + '1' { return big_A $Line } + '2' { return big_A $Line } + '3' { return big_A $Line } + '4' { return big_A $Line } + '5' { return big_A $Line } + '6' { return big_A $Line } + '7' { return big_A $Line } + '8' { return big_A $Line } + '9' { return big_A $Line } + } + return " " +} + +try { + if ($Text -eq "" ) { + [String]$Text = read-host "Enter text to write" + } + write-host "" + [char[]]$TextArray = $Text.ToUpper() + for ($Line = 0; $Line -lt 6; $Line++) { + foreach($Char in $TextArray) { + $Out = big_char $Char $Line + write-host -nonewline $Out + } + write-host "" + } + write-host "" + exit 0 +} catch { + write-error "ERROR in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" + exit 1 +}