Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Iterate through a VB dictionary.

$
0
0

Hey guys, so I'm trying to write a script that will take preassigned files and send them to a COM port. I've the COM part working, but for some reason I can't get syntax for iterating through a dictionary right.

set d = CreateObject("Scripting.Dictionary")
d.Add "0", "C:\rtlstuff\ipconfig.txt"
d.Add "1", "C:\rtlstuff\netstat.txt"


do while x < 2
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(d.Item x)

(Do something to file here)
x=x+1
loop

What I can't figure out is what to do for the line:

Set f = fso.OpenTextFile(d.Item x)
This doesn't work, any suggestion on how to correct it?


Viewing all articles
Browse latest Browse all 15028

Latest Images

Trending Articles



Latest Images