Week 6 Array Report

Topics: Windows Script Host, IP address, Internet Explorer Pages: 7 (1354 words) Published: August 27, 2013
Student Name| Roger Harrison| Class| Comp 230| Date| 8/15/13|
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: Roger Harrison
' Date: 08/15/13
' Class: COMP230
' Professor: Gasko
' ===================================
' 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"
ipAddress(1,3)="192.168.10.22"
ipAddress(2,0)="192.168.10.27"
ipAddress(2,1)="192.168.10.28"
ipAddress(2,2)="192.168.10.29"
ipAddress(2,3)="192.168.10.30"
ipAddress(3,0)="192.168.10.35"
ipAddress(3,1)="192.168.10.36"
ipAddress(3,2)="192.168.10.37"
ipAddress(3,3)="192.168.10.38"
ipAddress(4,0)="192.168.10.43"
ipAddress(4,1)="192.168.10.44"
ipAddress(4,2)="192.168.10.45"
ipAddress(4,3)="192.168.10.46"
ipAddress(5,0)="192.168.10.51"
ipAddress(5,1)="192.168.10.52"
ipAddress(5,2)="192.168.10.53"
ipAddress(5,3)="192.168.10.54"

Const READ=1, WRITE=2, APPEND=8, ASCII=0
fileName="C:\Scripts\IP_Addresses.csv"
Set fso = CreateObject("Scripting.FileSystemObject")

ipAddrStr = ""
If fso.FileExists(fileName) Then
fso.DeleteFile(fileName)
End If
Set ipAddrFile = fso.CreateTextFile(fileName,True)

For room = 0 to 5
For computer = 0 to 3

In the space provided below to copy and paste the remainder of your IP_FileWrite.vbs sourcecode if it did not fit in the first textbox. ipAddrStr = CStr(room+100) & "," & CStr(computer+1) & "," & _ ipAddress(room,computer) & vbCrlf

ipAddrFile.WriteLine(ipAddrStr)
Next
Next

ipAddrFile.Close

Set ipAddrFile = fso.OpenTextFile(fileName,READ,ASCII)
WScript.Echo ipAddrFile.ReadAll
ipAddrFile.Close

Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Scripts>cscript IP_FileWrite.vbs
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.

100,1,192.168.10.11
100,2,192.168.10.12
100,3,192.168.10.13
100,4,192.168.10.14
101,1,192.168.10.19
101,2,192.168.10.20
101,3,192.168.10.21
101,4,192.168.10.22
102,1,192.168.10.27
102,2,192.168.10.28
102,3,192.168.10.29
102,4,192.168.10.30
103,1,192.168.10.35
103,2,192.168.10.36
103,3,192.168.10.37
103,4,192.168.10.38
104,1,192.168.10.43
104,2,192.168.10.44
104,3,192.168.10.45
104,4,192.168.10.46
105,1,192.168.10.51
105,2,192.168.10.52
105,3,192.168.10.53
105,4,192.168.10.54
In the space provided below, copy and paste the RUN of your IP_FileWrite.vbs program. Also include the directory listing of all .csv files:

In the space provided below, copy and paste your IP_AppendRead.vbs program sourcecode. If it doesn’t fit, use the next page for the continuation of your program sourcecode. ' VBScript: IP_AppendRead.vbs

' Written by: Roger Harrison
' Date: 8/15/2013
' class: COMP230
' Professor: Gasko
'================================
'Define Constants
Const READ=1, WRITE=2, APPEND=8, ASCII=0
fileName="C:\Scripts\IP_Addresses.csv"
Set fso = CreateObject("Scripting.FileSystemObject")

ipAddrStr = ""
If fso.FileExists(fileName) Then
fso.DeleteFile(fileName)
End If
Set ipAddrFile = fso.CreateTextFile(fileName,True)

'Define new room Variables
newRoom = "106"
comp1_IP = "192.168.10.59"
comp2_IP = "192.168.10.60"
comp3_IP = "192.168.10.61"
comp4_IP = "192.168.10.62"

'Define Scripting.FileSystemObject
Set fso = CreateObject("Scripting.FileSystemObject")

'Define String to represent New Room Information
ipAddrStr = _...
Continue Reading

Please join StudyMode to read the full document

You May Also Find These Documents Helpful

  • Week 6 iLab Report Essay
  • Comp230 Week 6 Ip File Report Essay
  • Essay on Stat 221 week 6 ilab
  • ECO 550 WEEK 6 CHAPTER 11 AND CHAPTER 12 PROBLEMS Essay
  • Pinnacle Week 6 Video Analysis Report Essay
  • Report Essay
  • Arrays Essay
  • Arrays Essay

Become a StudyMode Member

Sign Up - It's Free