PowerShell/Scripts/write-braille.ps1

361 lines
5.9 KiB
PowerShell
Raw Normal View History

2021-02-09 19:30:45 +01:00
#!/bin/powershell
2020-12-29 15:14:21 +01:00
<#
.SYNTAX write-braille.ps1 [<text>]
.DESCRIPTION writes the given text in Braille
.LINK https://github.com/fleschutz/PowerShell
.NOTES Author: Markus Fleschutz / License: CC0
#>
2020-12-22 09:24:30 +01:00
2021-01-02 11:08:59 +01:00
param([string]$Text = "")
2020-12-22 09:24:30 +01:00
2021-01-27 15:12:17 +01:00
function BrailleA { param([int]$Row)
2020-12-22 09:24:30 +01:00
switch($Row) {
1 { return ".o" }
2 { return "oo" }
3 { return "oo" }
}
}
2021-01-27 15:12:17 +01:00
function BrailleB { param([int]$Row)
2020-12-22 09:24:30 +01:00
switch($Row) {
1 { return ".o" }
2 { return ".o" }
3 { return "oo" }
}
}
2021-01-27 15:12:17 +01:00
function BrailleC { param([int]$Row)
2020-12-22 09:24:30 +01:00
switch($Row) {
1 { return ".." }
2 { return "oo" }
3 { return "oo" }
}
}
2021-01-27 15:12:17 +01:00
function BrailleD { param([int]$Row)
2020-12-22 09:24:30 +01:00
switch($Row) {
1 { return ".." }
2 { return "o." }
3 { return "oo" }
}
}
2021-01-27 15:12:17 +01:00
function BrailleE { param([int]$Row)
2020-12-22 09:24:30 +01:00
switch($Row) {
1 { return ".o" }
2 { return "o." }
3 { return "oo" }
}
}
2021-01-27 15:12:17 +01:00
function BrailleF { param([int]$Row)
2020-12-22 09:24:30 +01:00
switch($Row) {
1 { return ".." }
2 { return ".o" }
3 { return "oo" }
}
}
2021-01-27 15:12:17 +01:00
function BrailleG { param([int]$Row)
2020-12-22 09:24:30 +01:00
switch($Row) {
1 { return ".." }
2 { return ".." }
3 { return "oo" }
}
}
2021-01-27 15:12:17 +01:00
function BrailleH { param([int]$Row)
2020-12-22 09:24:30 +01:00
switch($Row) {
1 { return ".o" }
2 { return ".." }
3 { return "oo" }
}
}
2021-01-27 15:12:17 +01:00
function BrailleI { param([int]$Row)
2020-12-22 09:24:30 +01:00
switch($Row) {
1 { return "o." }
2 { return ".o" }
3 { return "oo" }
}
}
2021-01-27 15:12:17 +01:00
function BrailleJ { param([int]$Row)
2020-12-22 09:24:30 +01:00
switch($Row) {
1 { return "o." }
2 { return ".." }
3 { return "oo" }
}
}
2021-01-27 15:12:17 +01:00
function BrailleK { param([int]$Row)
2020-12-22 09:24:30 +01:00
switch($Row) {
1 { return ".o" }
2 { return "oo" }
3 { return ".o" }
}
}
2021-01-27 15:12:17 +01:00
function BrailleL { param([int]$Row)
2020-12-22 09:24:30 +01:00
switch($Row) {
1 { return ".o" }
2 { return ".o" }
3 { return ".o" }
}
}
2021-01-27 15:12:17 +01:00
function BrailleM { param([int]$Row)
2020-12-22 09:24:30 +01:00
switch($Row) {
1 { return ".." }
2 { return "oo" }
3 { return ".o" }
}
}
2021-01-27 15:12:17 +01:00
function BrailleN { param([int]$Row)
2020-12-22 09:24:30 +01:00
switch($Row) {
1 { return ".." }
2 { return "o." }
3 { return ".o" }
}
}
2021-01-27 15:12:17 +01:00
function BrailleO { param([int]$Row)
2020-12-22 09:24:30 +01:00
switch($Row) {
1 { return ".o" }
2 { return "o." }
3 { return ".o" }
}
}
2021-01-27 15:12:17 +01:00
function BrailleP { param([int]$Row)
2020-12-22 09:24:30 +01:00
switch($Row) {
1 { return ".." }
2 { return ".o" }
3 { return ".o" }
}
}
2021-01-27 15:12:17 +01:00
function BrailleQ { param([int]$Row)
2020-12-22 09:24:30 +01:00
switch($Row) {
1 { return ".." }
2 { return ".." }
3 { return ".o" }
}
}
2021-01-27 15:12:17 +01:00
function BrailleR { param([int]$Row)
2020-12-22 09:24:30 +01:00
switch($Row) {
1 { return ".o" }
2 { return ".." }
3 { return ".o" }
}
}
2021-01-27 15:12:17 +01:00
function BrailleS { param([int]$Row)
2020-12-22 09:24:30 +01:00
switch($Row) {
1 { return "o." }
2 { return ".o" }
3 { return ".o" }
}
}
2021-01-27 15:12:17 +01:00
function BrailleT { param([int]$Row)
2020-12-22 09:24:30 +01:00
switch($Row) {
1 { return "o." }
2 { return ".." }
3 { return ".o" }
}
}
2021-01-27 15:12:17 +01:00
function BrailleU { param([int]$Row)
2020-12-22 09:24:30 +01:00
switch($Row) {
1 { return ".o" }
2 { return "oo" }
3 { return ".." }
}
}
2021-01-27 15:12:17 +01:00
function BrailleV { param([int]$Row)
2020-12-22 09:24:30 +01:00
switch($Row) {
1 { return ".o" }
2 { return ".o" }
3 { return ".." }
}
}
2021-01-27 15:12:17 +01:00
function BrailleW { param([int]$Row)
2020-12-22 09:24:30 +01:00
switch($Row) {
1 { return "o." }
2 { return ".." }
3 { return "o." }
}
}
2021-01-27 15:12:17 +01:00
function BrailleX { param([int]$Row)
2020-12-22 09:24:30 +01:00
switch($Row) {
1 { return ".." }
2 { return "oo" }
3 { return ".." }
}
}
2021-01-27 15:12:17 +01:00
function BrailleY { param([int]$Row)
2020-12-22 09:24:30 +01:00
switch($Row) {
1 { return ".." }
2 { return "o." }
3 { return ".." }
}
}
2021-01-27 15:12:17 +01:00
function BrailleZ { param([int]$Row)
2020-12-22 09:24:30 +01:00
switch($Row) {
1 { return ".o" }
2 { return "o." }
3 { return ".." }
}
}
2021-01-27 15:12:17 +01:00
function Braille1 { param([int]$Row)
2020-12-22 09:24:30 +01:00
switch($Row) {
1 { return ".o" }
2 { return "oo" }
3 { return "oo" }
}
}
2021-01-27 15:12:17 +01:00
function Braille2 { param([int]$Row)
2020-12-22 09:24:30 +01:00
switch($Row) {
1 { return ".o" }
2 { return ".o" }
3 { return "oo" }
}
}
2021-01-27 15:12:17 +01:00
function Braille3 { param([int]$Row)
2020-12-22 09:24:30 +01:00
switch($Row) {
1 { return ".." }
2 { return "oo" }
3 { return "oo" }
}
}
2021-01-27 15:12:17 +01:00
function Braille4 { param([int]$Row)
2020-12-22 09:24:30 +01:00
switch($Row) {
1 { return ".." }
2 { return "o." }
3 { return "oo" }
}
}
2021-01-27 15:12:17 +01:00
function Braille5 { param([int]$Row)
2020-12-22 09:24:30 +01:00
switch($Row) {
1 { return ".o" }
2 { return "o." }
3 { return "oo" }
}
}
2021-01-27 15:12:17 +01:00
function Braille6 { param([int]$Row)
2020-12-22 09:24:30 +01:00
switch($Row) {
1 { return ".." }
2 { return ".o" }
3 { return "oo" }
}
}
2021-01-27 15:12:17 +01:00
function Braille7 { param([int]$Row)
2020-12-22 09:24:30 +01:00
switch($Row) {
1 { return ".." }
2 { return ".." }
3 { return "oo" }
}
}
2021-01-27 15:12:17 +01:00
function Braille8 { param([int]$Row)
2020-12-22 09:24:30 +01:00
switch($Row) {
1 { return ".o" }
2 { return ".." }
3 { return "oo" }
}
}
2021-01-27 15:12:17 +01:00
function Braille9 { param([int]$Row)
2020-12-22 09:24:30 +01:00
switch($Row) {
1 { return "o." }
2 { return ".o" }
3 { return "oo" }
}
}
2021-01-27 15:12:17 +01:00
function Braille0 { param([int]$Row)
2020-12-22 09:24:30 +01:00
switch($Row) {
1 { return "o." }
2 { return ".." }
3 { return "oo" }
}
}
2021-01-27 15:12:17 +01:00
function BrailleChar { param([string]$Char, [int]$Row)
2020-12-22 09:24:30 +01:00
switch($Char) {
'A' { return BrailleA $Row }
'B' { return BrailleB $Row }
'C' { return BrailleC $Row }
'D' { return BrailleD $Row }
'E' { return BrailleE $Row }
'F' { return BrailleF $Row }
'G' { return BrailleG $Row }
'H' { return BrailleH $Row }
'I' { return BrailleI $Row }
'J' { return BrailleJ $Row }
'K' { return BrailleK $Row }
'L' { return BrailleL $Row }
'M' { return BrailleM $Row }
'N' { return BrailleN $Row }
'O' { return BrailleO $Row }
'P' { return BrailleP $Row }
'Q' { return BrailleQ $Row }
'R' { return BrailleR $Row }
'S' { return BrailleS $Row }
'T' { return BrailleT $Row }
'U' { return BrailleU $Row }
'V' { return BrailleV $Row }
'W' { return BrailleW $Row }
'X' { return BrailleX $Row }
'Y' { return BrailleY $Row }
'Z' { return BrailleZ $Row }
'1' { return Braille1 $Row }
'2' { return Braille2 $Row }
'3' { return Braille3 $Row }
'4' { return Braille4 $Row }
'5' { return Braille5 $Row }
'6' { return Braille6 $Row }
'7' { return Braille7 $Row }
'8' { return Braille8 $Row }
'9' { return Braille9 $Row }
'0' { return Braille0 $Row }
}
return " "
}
try {
if ($Text -eq "" ) {
[String]$Text = read-host "Enter text to write"
}
[char[]]$ArrayOfChars = $Text.ToUpper()
write-output ""
for ($Row = 1; $Row -lt 4; $Row++) {
$Line = ""
foreach($Char in $ArrayOfChars) {
$Line += BrailleChar $Char $Row
$Line += " "
}
write-output $Line
}
write-output ""
exit 0
} catch {
2021-02-16 10:03:20 +01:00
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
2020-12-22 09:24:30 +01:00
exit 1
}