概要
vbsの作法、調べてみた。
バイナリーファイルを表示してみた。
写真
サンプルコード
Dim App1
Dim Appflg
Dim Stream
Dim Bytes
Dim Chars
Dim c
Dim k
Dim buf
Set App1 = Createobject("OHIcompo6.srv")
WScript.ConnectObject App1, "App1_"
Sub App1_exit()
Appflg = 2
End Sub
Sub App1_ok()
Msgbox App1.text
End Sub
buf = ""
Set Stream = CreateObject("ADODB.Stream")
Stream.Open
Stream.Position = 0
Stream.Type = 1
Stream.LoadFromFile "hexread0.vbs"
Bytes = Stream.Read(-1)
Chars = ""
For k = 1 To LenB(Bytes)
If k Mod 16 = 1 Then
buf = buf & " " & Chars & vbcrlf
Chars = ""
End If
If k Mod 4 = 1 Then
buf = buf & " "
End If
c = AscB(MidB(Bytes, k, 1))
buf = buf & Mid(Hex(256 + c), 2)
If (c < 32) or (c > &h7f) Then
c = 32
End If
Chars = Chars & Chr(c)
Next
App1.text = buf
Set Stream = Nothing
Appflg = 1
Do
WScript.Sleep(100)
App1.ping
Loop until Appflg = 2
Set App1 = Nothing
以上。