vbsの作法 その76

# 概要
vbsの作法、調べてみた。
練習問題、やってみた。

# 練習問題
vbsで、base64デコードせよ。

# サンプルデータ

```
f0VMRgEBAQAAAAAAAAAAAAIAAwABAAAAAAAQADQAAABQEQAAAAAAADQAIAACACgABgAFAAEAAAAA
EAAAAAAQAAAAEAAjAAAAIwAAAAUAAAAAEAAAAQAAACQQAAAkEBAAJBAQABgAAAAYAAAABgAAAAAQ
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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EAAAADAAAAJBAQACQQAAAYAAAAAAAAAAAAAAAEAAAAAAAAAAEAAAACAAAA
AAAAAAAAAAA8EAAAsAAAAAQAAAAGAAAABAAAABAAAAAJAAAAAwAAAAAAAAAAAAAA7BAAADsAAAAA
AAAAAAAAAAEAAAAAAAAAEQAAAAMAAAAAAAAAAAAAACcRAAAnAAAAAAAAAAAAAAABAAAAAAAAAA==

```

# サンプルコード

```
Const adTypeBinary = 1
Const adTypeText = 2
Const adSaveCreateNotExist = 1
Const adSaveCreateOverWrite = 2
Dim st
Dim xmldom
Dim node
Dim inFile
Dim outFile
Dim cd
Dim sh
Dim str
Set sh = CreateObject("WScript.Shell")
cd = sh.CurrentDirectory
inFile = cd & "\base64.txt"
outFile = cd & "\test5.elf"
Set xmldom = CreateObject("Microsoft.XMLDOM")
Set node = xmldom.CreateElement("work")
node.DataType = "bin.base64"
Set st = CreateObject("ADODB.Stream")
st.Charset = "ascii"
st.Open
st.LoadFromFile(inFile)
str = st.ReadText
'msgbox str
node.Text = str
st.Close
bin = node.NodeTypedValue
st.Open
st.Charset = "Shift-JIS"
st.Type = adTypeBinary
st.Write bin
st.saveToFile outFile, adSaveCreateOverWrite
st.Close
Set st = Nothing
Set node = Nothing
Set xmldom = Nothing
msgbox "ok"




```

以上。