Presentation is loading. Please wait.

Presentation is loading. Please wait.

CN2180 Chapter 2 Kemtis Kunanuraksapong MSIS with Distinction, A+ MCTS, MCDST, MCP.

Similar presentations


Presentation on theme: "CN2180 Chapter 2 Kemtis Kunanuraksapong MSIS with Distinction, A+ MCTS, MCDST, MCP."— Presentation transcript:

1 CN2180 Chapter 2 Kemtis Kunanuraksapong MSIS with Distinction, A+ MCTS, MCDST, MCP

2 Agenda Introduction to Windows Script Host Assignment Quiz

3 Introduction to Windows Script Host WSH Core Object model – Figure 2.4 on page 33. WScript object can be referenced with out first being instantiated. WScript.Echo “Example: Using the WScript object’s Echo() method”

4 Working with WScript Object It provides access to a number of very useful methods such as CreateObject() DisconnectObject() Echo() Quit() Sleep()

5 Working with WScript Object (Cont.) WScript is a public or exposed object. WshController WshShell WshNetwork Must be instantiated. CreateObject() method

6 Working with WScript Object (Cont.) Appendix C on page 407 Table C.2 on page 409 Working with object properties Type script on page 412. Working with object method Type script on page 414

7 Configuring WSH Execution Host Override execution host settings on the fly Use.wsh to set execution host settings for each script

8 Configuring WSH Execution Host (Cont.) To configure by command line. Open Windows Console Type cscript [//options] or wscript [//options] Table 2.1 on page 36 Try run any script with //nologo //t:20 on both cscript.exe and wscript.exe

9 Configuring WSH Execution Host (Cont.) To configure WScript Desktop Execution. Open Windows Command Console Type wscript then click ok Figure 2.6 on page 38

10 Using.wsh.wsh file must have the same name as your script See code on page 40

11 Rock, Paper, and Scissors Designing the Game: 1.Define the resources used by this script 2.Display the game’s instructions 3.Provide a way for the user to select a choice

12 Rock, Paper, and Scissors Designing the Game: 4.Devise a way for the script to generate a random number. 5.Assign the computer’s choice based on the script’s randomly selected number. 6.Display the final results of the game.

13 Step 1 Page 43 ‘ is for comment. Dim to declare variable Set to set up an instance of WshShell to access properties and methods such as popup() method.

14 Step 2 Page 43 Popup() method to show the game instruction.

15 Step 3 Page 44 InputBox() method to take the input from user.

16 Step 4 Randomize statement is to initiate the random Int() to convert the number to integer Rnd() method is to generate random number from 0 to 1

17 Step 5 Page 44 Assigned appropriate value to CardImage

18 Step 6 Display the result Popup() method to display the result

19 Assignment Page 46 Challenges #1 Challenges #2 Add the result to Windows Event *HINT* See Appendix C


Download ppt "CN2180 Chapter 2 Kemtis Kunanuraksapong MSIS with Distinction, A+ MCTS, MCDST, MCP."

Similar presentations


Ads by Google