Prompt the User to Display

Author Message
angela

  • Total Posts : 3
  • Scores: 0
  • Reward points : 0
  • Joined: 1/23/2012
  • Status: offline
Prompt the User to Display Monday, January 23, 2012 7:35 AM (permalink)
0
I'm trying to write the code that follows the pseudocode shown below to prompt the user to specify if he or she wants to display the entire table of IP addresses.

' 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 NOT "Y" & "y" & "N" & "n" Then
    Beep Speaker Twice
    Display Msg "Error, Y,y,N,n response Only!!!"
  EndIf
While ans NOT "Y" & "y" & "N" & "n"
 
If ans is "Y" OR ans is "y" Then 
  For room = 0 to 5
    For computer = 0 to 3
      Display "The IP Address in Room " toString(room+100) “for Computer "
              toString(computer+1) " is " ipAddress(room,computer)
    EndFor
  EndFor 
      EndIf   
===================================
I THINK the beginning should look like this:

'Display All IP Address Y/N?
  Do
    WScript.Echo "Do you wish to Display all of the IP Address (Y/N)......"
 ans =
 
 
Am I right?  Where can I find help with translation?
 
#1
    ebgreen

    • Total Posts : 8227
    • Scores: 98
    • Reward points : 0
    • Joined: 7/12/2005
    • Status: offline
    Re:Prompt the User to Display Monday, January 23, 2012 7:43 AM (permalink)
    0
    Well in part it depends on if you want popups or if you want to only interact at the command line.
    "... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
    Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
    http://www.visualbasicscript.com/m_47117/tm.htm
     
    #2
      angela

      • Total Posts : 3
      • Scores: 0
      • Reward points : 0
      • Joined: 1/23/2012
      • Status: offline
      Re:Prompt the User to Display Monday, January 23, 2012 8:24 AM (permalink)
      0
      comand line
       
      #3
        ebgreen

        • Total Posts : 8227
        • Scores: 98
        • Reward points : 0
        • Joined: 7/12/2005
        • Status: offline
        Re:Prompt the User to Display Monday, January 23, 2012 8:30 AM (permalink)
        0
        Here is a very simple example of getting input at the command line:

        Option Explicit
        Dim oSTDIN
        Dim nNumber
        Set oSTDIN = WScript.STDIN
        WScript.Echo "Enter a number"
        nNumber = oSTDIN.ReadLine()
        WScript.echo "You entered " & nNumber
        <message edited by ebgreen on Monday, January 23, 2012 8:31 AM>
        "... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
        Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
        http://www.visualbasicscript.com/m_47117/tm.htm
         
        #4
          59cobalt

          • Total Posts : 979
          • Scores: 91
          • Reward points : 0
          • Joined: 7/17/2011
          • Status: offline
          Re:Prompt the User to Display Monday, January 23, 2012 10:27 AM (permalink)
          0
          Using WScript.Echo will place the cursor in the next line, though. It's probably better to use WScript.StdOut.Write instead.

          The easiest way to check for a y/n response is to LCase() or UCase() the value:
          If LCase(ans) <> "y" And LCase(ans) <> "n" Then
           '...
          End If
          Beeps can be sounded by echoing ASCII character 7:
          WScript.Echo Chr(7) & Chr(7)

           
          #5

            Online Bookmarks Sharing: Share/Bookmark

            Jump to:

            Current active users

            There are 0 members and 1 guests.

            Icon Legend and Permission

            • New Messages
            • No New Messages
            • Hot Topic w/ New Messages
            • Hot Topic w/o New Messages
            • Locked w/ New Messages
            • Locked w/o New Messages
            • Read Message
            • Post New Thread
            • Reply to message
            • Post New Poll
            • Submit Vote
            • Post reward post
            • Delete my own posts
            • Delete my own threads
            • Rate post

            2000-2012 ASPPlayground.NET Forum Version 3.9