Hi, I hope somebody can help. What I am doing is running ipconfig saving the output to a text file, then writing the information into an array, and then I am pulling out 1 peace of that information and using it as the variable branchvar1. Now problem I am having is when I am trying to compare that variable to an IP address. here is what it looks like:
Set sh = CreateObject("WScript.Shell")
Workfile = "c:\ipconfig.txt"
sh.run "%comspec% /c ipconfig > " & Workfile, 0, True
sh.run "ipconfig /batch" ,0,true
set objfso = createobject("Scripting.FileSystemObject")
set objtextfile = objfspenTextFile(workfile, ForReading)
do until objtextfile.AtEndOfStream
strnextline = objtextfile.ReadLine
if instr(strnextline, searchstring)then
redim preserve arrip(intsize)
arrip(intsize) = strnextline
intsize = intsize + 1
end if
loop
arrdg = split(arrip(4), ":")
branchvar1 = arrdg(1)
now when i try and write the
if branchvar1 = "172.16.172.1" then
brancharray(1,0) = "scott"
wscript.echo brancharray(1,0)
end if
nothing happens...i know that branchvar1 = 172.16.172.1, because when I wscript.echo branchvar1 that is what it gives me. I am using the wscript.echo brancharray(1,0) to make sure it is reading the if statement. when i test in onscript editor on the output nothing happens it just says completed
Scott
"Global Warming is caused by the sun" - Anonymous
Set sh = CreateObject("WScript.Shell")
Workfile = "c:\ipconfig.txt"
sh.run "%comspec% /c ipconfig > " & Workfile, 0, True
sh.run "ipconfig /batch" ,0,true
set objfso = createobject("Scripting.FileSystemObject")
set objtextfile = objfspenTextFile(workfile, ForReading)
do until objtextfile.AtEndOfStream
strnextline = objtextfile.ReadLine
if instr(strnextline, searchstring)then
redim preserve arrip(intsize)
arrip(intsize) = strnextline
intsize = intsize + 1
end if
loop
arrdg = split(arrip(4), ":")
branchvar1 = arrdg(1)
now when i try and write the
if branchvar1 = "172.16.172.1" then
brancharray(1,0) = "scott"
wscript.echo brancharray(1,0)
end if
nothing happens...i know that branchvar1 = 172.16.172.1, because when I wscript.echo branchvar1 that is what it gives me. I am using the wscript.echo brancharray(1,0) to make sure it is reading the if statement. when i test in onscript editor on the output nothing happens it just says completed
Scott
"Global Warming is caused by the sun" - Anonymous