2014-git-work/powershell/serialmonitor.ps1

29 lines
1.2 KiB
PowerShell
Raw Normal View History

2012-08-28 22:46:51 +09:00
<EFBFBD><EFBFBD># COM<00>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD><30><EFBFBD>0
$form = new-object Windows.Forms.Form
$form.text = "com<00>0<EFBFBD>0<EFBFBD>0n0x<30><78>b"
$form.KeyPreview = $True
$form.Add_KeyDown({
if ($_.KeyCode -eq "Enter"){
$comport=$textBox.Text
$form.Close()
}
})
$form.Add_KeyDown({
if ($_.KeyCode -eq "Escape"){
$form.Close()
}
})
$textBox = New-Object System.Windows.Forms.TextBox
$form.Controls.Add($textBox)
$form.Add_Shown($form.Activate())
$form.ShowDialog()
$port = New-Object System.IO.Ports.SerialPort "COM$comport", 9600, None, 8, one
$port.Open()
while(1){echo $port.ReadLine()}