-
-
Save orange-in-space/1d36ebb3c9a6e922ee21439788f8de31 to your computer and use it in GitHub Desktop.
PowerShell 超簡易版音楽鍵盤!><;(酷い)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Power Shell Cheapest Musical Keyboard | |
# (C) orange_in_space 2021 | |
Add-Type -AssemblyName System.Windows.Forms | |
Add-Type -AssemblyName System.Drawing | |
$form = New-Object System.Windows.Forms.Form | |
$form.Text = "PowerShell音楽鍵盤!><;" | |
$form.Size = New-Object System.Drawing.Size(640,180) | |
$TCButton = New-Object System.Windows.Forms.Button | |
$TCButton.Location = New-Object System.Drawing.Point(10,100) | |
$TCButton.Size = New-Object System.Drawing.Size(60,30) | |
$TCButton.Text = "&C" | |
$TCButton.DialogResult = "OK" | |
$TDButton = New-Object System.Windows.Forms.Button | |
$TDButton.Location = New-Object System.Drawing.Point(90,100) | |
$TDButton.Size = New-Object System.Drawing.Size(60,30) | |
$TDButton.Text = "&D" | |
$TDButton.DialogResult = "Abort" | |
$TEButton = New-Object System.Windows.Forms.Button | |
$TEButton.Location = New-Object System.Drawing.Point(170,100) | |
$TEButton.Size = New-Object System.Drawing.Size(60,30) | |
$TEButton.Text = "&E" | |
$TEButton.DialogResult = "Retry" | |
$TFButton = New-Object System.Windows.Forms.Button | |
$TFButton.Location = New-Object System.Drawing.Point(250,100) | |
$TFButton.Size = New-Object System.Drawing.Size(60,30) | |
$TFButton.Text = "&F" | |
$TFButton.DialogResult = "Ignore" | |
$TGButton = New-Object System.Windows.Forms.Button | |
$TGButton.Location = New-Object System.Drawing.Point(330,100) | |
$TGButton.Size = New-Object System.Drawing.Size(60,30) | |
$TGButton.Text = "&G" | |
$TGButton.DialogResult = "Yes" | |
$TAButton = New-Object System.Windows.Forms.Button | |
$TAButton.Location = New-Object System.Drawing.Point(410,100) | |
$TAButton.Size = New-Object System.Drawing.Size(60,30) | |
$TAButton.Text = "&A" | |
$TAButton.DialogResult = "No" | |
$TBButton = New-Object System.Windows.Forms.Button | |
$TBButton.Location = New-Object System.Drawing.Point(250,100) | |
$TBButton.Size = New-Object System.Drawing.Size(60,30) | |
$TBButton.Text = "&B" | |
$TBButton.DialogResult = "None" | |
# キャンセルボタンの設定 | |
$CancelButton = New-Object System.Windows.Forms.Button | |
$CancelButton.Location = New-Object System.Drawing.Point(500,100) | |
$CancelButton.Size = New-Object System.Drawing.Size(75,30) | |
$CancelButton.Text = "Exit" | |
$CancelButton.DialogResult = "Cancel" | |
# 列挙子名:None, OK, Cancel, Abort, Retry, Ignore, Yes, No | |
$label = New-Object System.Windows.Forms.Label | |
$label.Location = New-Object System.Drawing.Point(10,30) | |
$label.Size = New-Object System.Drawing.Size(480,40) | |
$label.Text = "ALTキーを押しながらキーボードで演奏するとちょっとだけ楽だよ!>< 超ゆっくり弾いてね!><;" | |
# $form.AcceptButton = $OKButton | |
$form.CancelButton = $CancelButton | |
$form.Controls.Add($TCButton) | |
$form.Controls.Add($TDButton) | |
$form.Controls.Add($TEButton) | |
$form.Controls.Add($TFButton) | |
$form.Controls.Add($TGButton) | |
$form.Controls.Add($TAButton) | |
$form.Controls.Add($CancelButton) | |
$form.Controls.Add($label) | |
while ($true) | |
{ | |
$result = $form.ShowDialog() | |
if ($result -eq "Cancel") | |
{ | |
break | |
} | |
switch ($result) | |
{ | |
"OK" | |
{ | |
[Console]::Beep(262, 500) | |
} | |
"Abort" | |
{ | |
[Console]::Beep(294, 500) | |
} | |
"Retry" | |
{ | |
[Console]::Beep(330, 500) | |
} | |
"Ignore" | |
{ | |
[Console]::Beep(349, 500) | |
} | |
"Yes" | |
{ | |
[Console]::Beep(392, 500) | |
} | |
"No" | |
{ | |
[Console]::Beep(440, 500) | |
} | |
"None" | |
{ | |
[Console]::Beep(523, 500) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment