Computers - Software Hardware : I have another scripting problem

Discussion in 'Science and Technology' started by blazejay, May 24, 2012.

  1. blazejay

    blazejay Well-Known Member MEMBER

    Country:
    United States
    Joined:
    Apr 14, 2012
    Messages:
    239
    Likes Received:
    127
    Gender:
    Male
    Ratings:
    +165
    Hello,

    I have another problem that either I am not understanding or misread the instructions.
    It asking me to create the program,but I am still not comprehending what the instruction ask even to make the problem complex, I am trying to figure it out but have no clue where to start to debug the program/script.
    I will try to attach or when you comment send the instructions via e-mail.

    Thank you for the help
     
  2. blazejay

    blazejay Well-Known Member MEMBER

    Country:
    United States
    Joined:
    Apr 14, 2012
    Messages:
    239
    Likes Received:
    127
    Gender:
    Male
    Ratings:
    +165
    Code:
    ' VBScript: IP_Array_start.vbs
    ' Written by:Student Name
    ' Date:5/22/12
    ' Class: COMP230
    ' Professor:
    ' ===================================
    ' This initialize 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"
     
  3. blazejay

    blazejay Well-Known Member MEMBER

    Country:
    United States
    Joined:
    Apr 14, 2012
    Messages:
    239
    Likes Received:
    127
    Gender:
    Male
    Ratings:
    +165
    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"

    'Define Script Variables
    roomStr = ""
    compStr = ""
    room = 0
    computer = 0

    Do While Display Prompt "Please Enter the Room Number (100-105) ...... "
    Get StdIn Console Input and assign string value to roomStr
    room = CInt(roomStr)
    If room < 100 OR room > 105
    Use StdOut to Beep Speaker twice with chr(7)
    Display ErrMsg “Error, 100 to 105 Only!!!”
    endif
    Loop While room < 100 OR room > 105

    Do
    Display Prompt “Please Enter the Computer Number (1-4) ...... “
    Get StdIn Console Input and assign string value to compStr
    computer = CInt(compStr)
    If computer < 1 OR computer > 4
    Use StdOut to Beep Speaker twice with chr(7)
    Display ErrMsg “Error, 1 to 4 Only!!!”
    endif
    Loop While computer < 1 OR computer > 4

    ' Display All IP Address Y/N?
    Do
    Display Message
    "Do you wish to Display all of the IP Addresses (Y/N) ..... "
    Get User Response and assign it to variable ans
    If ans isn’t "Y" & ans isn’t "y" & ans isn’t "N" & ans isn’t "n" Then
    Beep Speaker Twice
    Display Msg "Error, Y,y,N,n response Only!!!" & skip line
    EndIf
    Loop While ans isn’t "Y" & ans isn’t "y" & ans isn’t "N" & ans isn’t "n"

    If ans is "Y" OR ans is "y" Then
    skip line
    For roomNum = 0 to 5
    For compNum = 0 to 3
    Display "The IP Address in Room " room+100 “ for Computer "
    computer+1 " is " ipAddress(room,computer)
    EndFor
    EndFor
    EndIf
     
  4. Gorilla

    Gorilla Well-Known Member MEMBER

    Country:
    United States
    Joined:
    Jan 31, 2009
    Messages:
    2,479
    Likes Received:
    1,382
    Gender:
    Male
    Ratings:
    +1,399
    What are you having problems with exactly? Is it understanding what a two dimensional array is?
     
  5. blazejay

    blazejay Well-Known Member MEMBER

    Country:
    United States
    Joined:
    Apr 14, 2012
    Messages:
    239
    Likes Received:
    127
    Gender:
    Male
    Ratings:
    +165
    yes it was,but I had to turn in what I had and it was correct.
    This week is somewhat easy, but I need to know or understand how to use case and sub in a modularized program.
    For example Case "1"
    Call System_Information

    Sub System_Information
    Set WshShell = WScript.CreateObject("WScript.Shell")
    WScript.Echo "The computer name is ............ " & _
    WshShell.ExpandEnvironmentStrings("%COMPUTERNAME%")
    WScript.Echo "The Num of CPUs is .............. " & _
    WshShell.ExpandEnvironmentStrings("%NUMBER_OF_PROCESSORS%")
    WScript.Echo "The Processor Architecture is ... " & _
    WshShell.ExpandEnvironmentStrings("%PROCESSOR_ARCHITECTURE%")
    End Sub

    My question here do I place the sub syntax above the case or keep it the same also ifI keep it the same why does it give a error of subscript out of range when I run it?
     
  6. Gorilla

    Gorilla Well-Known Member MEMBER

    Country:
    United States
    Joined:
    Jan 31, 2009
    Messages:
    2,479
    Likes Received:
    1,382
    Gender:
    Male
    Ratings:
    +1,399

    Switches/Cases are ways to do neater evaluations of a condition and then act accordingly. In VBScript, it looks like this (I just looked this up):

    Code:
    Select Case num
    Case "1"
    <do something>
    Case "2"
    <do something>
    Case "3"
    <do something>
    <do another thing>
    Case "4","5","6","7"  <do one thing>:<do another thing>
    Case Else
    <do something in case of failure or by default>
    End Select
    
    http://www.microsoft.com/en-us/download/details.aspx?id=326 (VBScript Quick Reference)
    http://msdn.microsoft.com/en-us/library/9t9x467f(v=vs.85).aspx (Using Conditional Statements)

    Just out of curiosity, does this course have a textbook? A lot of times the fastest way to get around a syntax question is using the index of a book or google.
     
  7. blazejay

    blazejay Well-Known Member MEMBER

    Country:
    United States
    Joined:
    Apr 14, 2012
    Messages:
    239
    Likes Received:
    127
    Gender:
    Male
    Ratings:
    +165

    Yes it does, but this is not in it unfortunately.
     
  8. Gorilla

    Gorilla Well-Known Member MEMBER

    Country:
    United States
    Joined:
    Jan 31, 2009
    Messages:
    2,479
    Likes Received:
    1,382
    Gender:
    Male
    Ratings:
    +1,399
    You may want to consider grabbing a book on VBScript. I just did a quick check on Amazon and they look pretty affordable.
     
  9. blazejay

    blazejay Well-Known Member MEMBER

    Country:
    United States
    Joined:
    Apr 14, 2012
    Messages:
    239
    Likes Received:
    127
    Gender:
    Male
    Ratings:
    +165
    I will give a go next week because if this suppose to be easy imagine the next two weeks.
     
  10. Gorilla

    Gorilla Well-Known Member MEMBER

    Country:
    United States
    Joined:
    Jan 31, 2009
    Messages:
    2,479
    Likes Received:
    1,382
    Gender:
    Male
    Ratings:
    +1,399
    It just may be helpful to have a supplementary text if your main text treats the subject sparsely. I would check the library (public and school). There's a chance your school or public library might provide access to something like Safari Online. That's a good way to get access to text material.

    Good luck.
     
Loading...

Users found this page by searching for:

  1. 192.168.10.19/kbrothers/student.php

    ,
  2. psuedocode Display message The IP Address in Room roomStr for computer compStr is ipAddress(room-100 computer-1)

    ,
  3. Display message The IP Address in Room roomStr for computer compStr is ipAddress(room-100 computer-1)