PowerShell/Scripts/simulate-matrix.ps1

55 lines
2.1 KiB
PowerShell
Raw Normal View History

2021-09-27 10:38:12 +02:00
<#
2021-07-13 21:10:02 +02:00
.SYNOPSIS
2021-09-24 17:19:49 +02:00
Simulates the Matrix (fun)
2021-10-04 21:29:23 +02:00
.DESCRIPTION
2021-10-16 16:50:10 +02:00
This script simulates the Matrix (for fun).
2021-07-13 21:10:02 +02:00
.EXAMPLE
2021-09-24 17:19:49 +02:00
PS> ./simulate-matrix
2021-08-29 17:50:03 +02:00
.NOTES
Author: Markus Fleschutz · License: CC0
2021-07-13 21:10:02 +02:00
.LINK
https://github.com/fleschutz/PowerShell
2020-12-29 15:14:21 +01:00
#>
2020-12-15 15:21:50 +01:00
try {
2021-04-21 13:05:41 +02:00
$Table = import-csv "$PSScriptRoot/../Data/matrix.csv"
2020-12-15 15:21:50 +01:00
2020-12-29 15:14:21 +01:00
clear-host
2020-12-15 15:21:50 +01:00
foreach($Row in $Table) {
for ($i = 0; $i -lt 4; $i++) {
2021-05-01 18:21:12 +02:00
write-host -foregroundColor green -noNewline $($Row.A)
write-host -foregroundColor green -noNewline $($Row.B)
write-host -foregroundColor green -noNewline $($Row.C)
write-host -foregroundColor green -noNewline $($Row.D)
write-host -foregroundColor green -noNewline $($Row.E)
write-host -foregroundColor green -noNewline $($Row.F)
write-host -foregroundColor green -noNewline $($Row.G)
2021-04-21 13:03:36 +02:00
write-host -foregroundColor green -noNewline $($Row.H); start-sleep -milliseconds 1
2021-05-01 18:21:12 +02:00
write-host -foregroundColor green -noNewline $($Row.I)
write-host -foregroundColor green -noNewline $($Row.J)
write-host -foregroundColor green -noNewline $($Row.K)
write-host -foregroundColor green -noNewline $($Row.L)
write-host -foregroundColor green -noNewline $($Row.M)
write-host -foregroundColor green -noNewline $($Row.N)
write-host -foregroundColor green -noNewline $($Row.O)
2021-04-21 13:03:36 +02:00
write-host -foregroundColor green -noNewline $($Row.P); start-sleep -milliseconds 1
2021-05-01 18:21:12 +02:00
write-host -foregroundColor green -noNewline $($Row.Q)
write-host -foregroundColor green -noNewline $($Row.R)
write-host -foregroundColor green -noNewline $($Row.S)
write-host -foregroundColor green -noNewline $($Row.T)
write-host -foregroundColor green -noNewline $($Row.U)
write-host -foregroundColor green -noNewline $($Row.V)
write-host -foregroundColor green -noNewline $($Row.W)
write-host -foregroundColor green -noNewline $($Row.X)
write-host -foregroundColor green -noNewline $($Row.Y)
2021-04-21 13:03:36 +02:00
write-host -foregroundColor green -noNewline $($Row.Z); start-sleep -milliseconds 1
2020-12-15 15:21:50 +01:00
}
2020-12-29 15:14:21 +01:00
write-host ""
start-sleep -milliseconds 200
2020-12-15 15:21:50 +01:00
}
2021-09-27 10:09:45 +02:00
exit 0 # success
2020-12-15 15:21:50 +01:00
} catch {
2021-09-16 20:19:10 +02:00
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
2020-12-15 15:21:50 +01:00
exit 1
}