Comp230 Week 6 Ip File Report Essay

1325 WordsOct 17, 20126 Pages
VBScript IP File Report In the space provided below, copy and paste your IP_FileWrite.vbs program sourcecode. If it doesn’t fit, use the next page for the continuation of your program sourcecode. ' VBScript: IP_FileWrite.vbs ' Written by: ' Date: ' Class: ' Professor: ' =================================== ' This initializes a 2-dimension array ' of IP Address. The first index +100 ' is the room# and the second index+1 ' is the computer# in the room. dim ipAddress(5,3) ipAddress(0,0)="192.168.10.11" ipAddress(0,1)="192.168.10.12" ipAddress(0,2)="192.168.10.13" ipAddress(0,3)="192.168.10.14" ipAddress(1,0)="192.168.10.19" ipAddress(1,1)="192.168.10.20" ipAddress(1,2)="192.168.10.21"…show more content…
If fso.FileExists(fileName) Then wscript.echo " " else wscript.echo(chr(7) & chr(7) & "File Does Not Exist!!!" & vbCrLf) wscript.echo("You Must Create the File Before You can Read the File !!") WScript.Quit End If In the space provided below to copy and paste the remainder of your IP_AppendRead.vbs sourcecode if it did not fit in the first textbox. 'Set file object Set ipAddrFile = fso.OpenTextFile(fileName,APPEND,ASCII) 'Append and close file For room = 6 to 6 For computer = 4 to 4 ipAddrStr = _ CStr(newroom) & ",1," & CStr(comp1_IP) & vbCrLf & _ CStr(newroom) & ",2," & CStr(comp2_IP) & vbCrLf & _ CStr(newroom) & ",3," & CStr(comp3_IP) & vbCrLf & _ CStr(newroom) & ",4," & CStr(comp4_IP) & vbCrLf & _ ipAddrFile.Write(ipAddrStr) Next Next ipAddrFile.Close 'Open appended file, display contents, and close file. Set ipAddrFile = fso.OpenTextFile(fileName,READ,ASCII) Do Until ipAddrFile.AtEndOfStream = True room = ipAddrFile.Read(3) ipAddrStr = ipAddrFile.Skip(1) computer = ipAddrFile.Read(1) ipAddrStr = ipAddrFile.Skip(1) ipAddress = ipAddrFile.Read(13) ipAddrStr = ipAddrFile.SkipLine() wscript.echo("The IP Address in Room " & room & " for Computer " & computer & " is " & ipAddress) Loop ipAddrFile.Close In the space provided below, copy and paste the RUN of your

    More about Comp230 Week 6 Ip File Report Essay

      Open Document