Advertisement
Olkach

IT 221 Week 3 DQ2

Dec 1st, 2014
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.79 KB | None | 0 0
  1.  
  2. There is IT 230 Week 6 Remote Access Solution in this pack.
  3. Computer Science - General Computer Science
  4. VBScript Modular Programming Lab
  5.  
  6. Objective
  7.  
  8. In this lab, students will complete the following objectives.
  9.  
  10. ·  Create a VBScript program using NotePad++.
  11.  
  12. ·  Use procedures to modularize a VBScript program.
  13.  
  14. ·  Create a library of procedures.
  15.  
  16. ·  Run library procedures from a separate VBScript program.
  17.  
  18. Element K Network Connections
  19.  
  20.  
  21.  
  22. For this lab, we will only need to connect to vlab-PC1 . The computer vlab-PC1 is the computer on the left side while vlab-PC2 is on the right. If you leave the cursor on the PC icon for a few seconds, a tool-tip message will appear indicating the hostname of the PC. Open  vlab-PC1 and log in as Administrator with the password password .
  23.  
  24.  
  25.  
  26. Note: All captures must be text only — DO NOT capture the NotePad++ application window or the command prompt window. Use copy and paste of text only.
  27.  
  28. Task 1: Ensure that the PC_Tests Scripts are in C:\Scripts\
  29.  
  30. Open the Windows CLI Using the Desktop or Quick Launch Command Prompt icon. Change Directory  to the C:\Scripts\ folder ( cd \Scripts) . Verify that the files PC_Tests.cmd and PC_Tests.vbs exists in this directory. If the files are absent, they can be extracted from the downloaded Doc Sharing file PC_Tests.zip .
  31.  
  32. Task 2: Open C:\Scripts\PC_Tests.cmd in NotePad++
  33.  
  34.  
  35.  
  36. Open NotePad++ and use File/Open to view the C:\Scripts\PC_Tests.cmd script file in the Editor window.
  37.  
  38. An analysis of the PC_Tests.cmd Batch script program is shown on the next page.
  39.  
  40.  
  41.  
  42. Task 2: Analyze the Batch Script File PC_Tests.cmd
  43.  
  44. One of the drawbacks of using VBScript instead of a full-featured programming language such as C++ or Java is the fact that VBScript does not have the capability to clear the command prompt screen. This is one of the things we need to do with our menu-driven PC_Tests program each time the menu is re-displayed. Since we can’t do this in VBScript, we will do it in a Batch script file.
  45.  
  46. Look at the PC_Tests.cmd Batch script shown on the right. The script performs the following tasks.
  47.  
  48.  
  49. 1. Clear the screen (CLS).
  50.  
  51. 2. Display the menu .
  52.  
  53. 3. Prompt the User and store the input into
  54.    choice.
  55.  
  56. 4. Run the PC_Tests.vbs program and
  57.  
  58.    send it the choice value (1..5) as an
  59.  
  60.    argument   (//nologo hides the scripting
  61.    host heading).
  62.  
  63. 5. When the PC_Tests.vbs program exits
  64.  
  65.    and returns to the Batch script, execute
  66.    a Pause .
  67.  
  68. 6. After the user presses a key to end the
  69.    pause, go to the start of the script to
  70.    clear the screen and re-display the
  71.    menu.  
  72.  
  73. A sample Batch script run of Option 1 is shown below.
  74.  
  75. Task 3: Analyze the code in the PC_Tests.vbs Program
  76.  
  77. ·  Open the PC_Tests.vbs program in NotePad++. Let’s review some code that can tell us many important things about the computer and the Windows Operating System.  Option 1 from the menu is handled by Case “1” in the Select Case statement . The VBScript code shows how to access the values of Windows Environmental variables using the WScript.Shell object’s ExpandEnvironmentStrings( ) function. Note that the environmental variables must be delimited with the % character. Do a search for Windows Environmental Variables. They can provide a wealth of information about the computer and the operating system.  A Run of this code is shown belo
  78.  
  79. ·  Option
  80.  
  81. To get more course tutorials visit - https://bitly.com/1xpypHt
  82.  
  83. Allow yourself short breaks. If you study for long periods of time, you can experience burn out. Your parents probably scoff at the idea, but it is possible to study too much. To avoid burnout, take a break and go hang out with friends every once in a while.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement