1. Trang chủ
  2. » Công Nghệ Thông Tin

Microsoft WSH and VBScript Programming for the Absolute Beginner Part 51 pot

10 229 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 10
Dung lượng 505,68 KB

Nội dung

480 Microsoft WSH and VBScript Programming for the Absolute Beginner, Second Edition • Project management • Syntax checking To learn more about ModelWorks SitePad Pro, or to purchase a licensed copy, visit http://www .modelworks.com/products.html. Figure C.3 The ModelWorks SitePad Pro editor. What Next? D CHAPTER T his book represents the beginning, not the end, of your VBScript pro- gramming experience. To become an effective and sought-after program- mer, it is important you work diligently to continue learning as much as possible. The best way to do this is to start writing your own scripts and to exper- iment and try new things as you go. It’s equally important that you continue to read and learn more about VBScript, the WSH, and programming in general. To help you on this journey, I have assembled a list of books and Web sites where you can learn more and find tons of sample scripts. Recommended Reading The following list of books will provide you with additional information about both VBScript and the WSH. Also included in this list are books covering VBScript’s close relatives, VBA and Visual Basic. • Learn VBScript In a Weekend . ISBN: 1931841705; Premier Press, 2002. This book provides additional beginner-level coverage of VBScript. It splits its focus between the use of VBScript in Web page development and as a scripting language for use with the WSH, providing a next step in the event that you’re interested in spicing up your Web site using VBScript. • Microsoft Windows Shell Scripting and WSH Administrator’s Guide. ISBN: 1931841268; Premier Press, 2002. This book is designed to assist you in con- tinuing your VBScript and WSH education by preparing you to use both in the real world. It’s a great guide for current or future system administra- tors, programmers, and power users. Besides covering VBScript, this book also provides you with a foundation for developing scripts using JScript. APPENDIX 482 • Microsoft Visual Basic .NET Programming for the Absolute Beginner. ISBN: 1592000029; Premier Press, 2002. This book is an excellent next step, should you want to use your knowledge of VBScript as a stepping stone for learning Microsoft Visual Basic .Net. You will find that you have been well-served by your new VBScript background as you add Visual Basic to your bag of programming tricks. • Microsoft Excel VBA Programming for the Absolute Beginner. ISBN: 1931841047; Premier Press, 2002. This book provides you with everything you need to learn to apply Microsoft VBA to Microsoft Excel. Thanks to its close relationship with VBScript, you’ll find that you have a head start on your VBA learning curve, and that you’re developing VBA games in no time as you learn to become a VBA programmer. • VBScript in a Nutshell. ISBN: 1565927206; O’Reilly & Associates, 2000. This book pro- vides experienced VBScript programmers with a complete language reference. Here you will find a detailed element-by-element breakdown of every aspect of VBScript, including the syntax of every VBScript statement, constant, operator, and function. • Microsoft VBScript Professional Projects. ISBN: 1592000568; Premier Press, 2003. This book demonstrates advanced VBScript programming concepts in the form of four hands-on projects. Each project focuses on a specific set of concepts based on real word situations. Locating WSH and VBScript Resources Online There is more to VBScript than can be found in books alone. Much of the information about this topic is free and can be found on the Internet. The following section discusses Web sites that provide you with a place to begin your research. The MSDN Scripting Web page (at http://www.msdn.microsoft.com/scripting), shown in Fig- ure D.1, is Microsoft’s official site for all things VBScript and WSH. Here you’ll find language references for both VBScript and JScript, as well as detailed documentation on the WSH. You also can download and install the latest version of the WSH, join scripting newsgroups, and view sample scripts. The Win32 Scripting Web site (at http://cwashington.netreach.net), shown in Figure D.2, pro- vides an abundance of information for a number of scripting languages, including VBScript. Here you will find plenty of documentation, a chat room, and tons of downloadable sample script examples. Another good site, shown in Figure D.3, is http://www.windowsitpro.com/WindowsScripting. This site provides access to Windows Scripting Solutions magazine. You have to pay to sub- scribe to this service to access its articles on scripting. But even if you don’t, you’ll still be able to access free articles and plenty of sample scripts. Microsoft WSH and VBScript Programming for the Absolute Beginner, Second Edition 483 Appendix D • What Next? Figure D.1 The MSDN Scripting page. Figure D.2 The Win32 Scripting Web site. 484 WSHScripting.com (at http://www.wshscripting.com), shown in Figure D.4, is another good site for Windows WSH documentation. You’ll also find a number of good articles and plenty of sample scripts. Microsoft WSH and VBScript Programming for the Absolute Beginner, Second Edition Figure D.3 WindowsIT Pro Web site. Figure D.4 WSHScripting.com Web site. Another good site is Winscripter, which is located at http://www.winscripter.com and is shown in Figure D.5. Here you will find articles, sample scripts, and an online message board where you can post and receive answers to your questions. In addition, you will find an abundance of WSH documentation and links to other helpful Web sites. One other site you may want to visit is http://www.w3schools.com/vbscript. Here you will find a VBScript tutorial as well as access to plenty of sample scripts. 485 Appendix D • What Next? Figure D.5 The Winscripter site. Figure D.6 http://www .w3schools.com/ vbscript. This page intentionally left blank A AboutFunction(), 419 Abs(), 467 Add (dictionary), 77 Add (folders), 77 AddPrinterConnection(), 46 AddWindowsPrinterConnection(), 46, 441–443 Adersoft VbsEdit, 477–478 Administration of computer, 444–448 of desktop, 434–437 of files or folders, 248–253 of network, 438–441 of printers, 441–444 scheduling, 448–453 AppActivate(), 46 Arguments defined, 42, 55, 194 passing to scripts, 135–137 Arithmetic operators, 118–121 Array(), 467 Arrays defined, 104, 124 dynamic, 133–134 erasing, 135 multiple-dimension, 126–127 naming, 126 processing contents, 127–129 resizing, 130–133 single-dimension, 125–126 size of, 129–130 Asc(), 112, 467 ASP (Active Server Pages), 20, 25 AT, 448–450 AtEndOfLine, 42, 75 AtEndOfStream, 42, 75, 245 Atn(), 467 Attributes, 75 AvailableSpace, 75 B Background, desktop, 434–436 .bat, 8 BlackJack Lite game, 203–205 designing, 216–230 Blank lines, adding, 244 Blank spaces in file names, 55 BooLean, 111, 116 BuildDisplayString(), 258, 266 BuildPath, 77 Byte, 111, 116 C Call, 69 Captain Adventure, 101–103 designing, 137–144 Cbool(), 112, 467 Cbur(), 112 Cbyte(), 112, 467 Ccur(), 467 Cdate(), 112, 467 CDbl(), 112, 468 CD-Rom, examples on, 473–480 Character, 42 Characters, writing, 242–243 CheckIfGameWon(), 305–306 Chr(), 112, 468 Cint(), 112, 468 Class_Initialize, 358–361 Class (object), 73, 354, 356 Class (statement), 69 Class_Terminate, 358 Clear(), 355, 362 ClearGameBoard(), 369, 372 CLng(), 112, 468 Close, 77 Close(), 46, 241 CloseTextFile(), 241 Closing files, 238–242 .cmd, 8 Index 488 CMD.exe, 11 CollectPlayerInput(), 258, 263–264 Column, 42, 76 Command-line execution, 51–53 overriding, 54–55 Command prompt, 10–11 executing script from, 17–18 <comment> </comment> tags, 400, 402 Comments, adding, 70–73 CompareMode, 76 Comparison operators, 161–162 Computer administration, 444–448 ComputerName, 42 ComputerPlay(), 217, 223 Conditional logic comparison operators, 161–162 if, 147, 148–151 select case, 147, 158–161 Configuration settings defined, 253 desktop background, 434–436 screen saver, 436–437 storing, in external files, 253–257 Configuring execution hosts, 51–58 ConnectObject(), 46 ConsoleLoop(), 413–415 Const, 69, 104, 105 Constant, 44 Constants assigning data to, 104–107 date and time, 107–108 naming, 106 private, 105 public, 105 string, 108–110 ConstName, 105 Copy(), 77, 249 CopyFile(), 77, 248, 249–250 CopyFolder(), 77, 248, 251–252 Core object model, 7–8 defined, 37 object methods, 45–51 object properties, 41–45 objects, list of, 39–41 Cos(), 468 Count, 46, 76 CreateDisplayString(), 236–237 CreateFolder(), 77, 248, 251 CreateObject(), 16, 38, 46, 59, 236, 468 CreateScript(), 46 CreateShortcut(), 46 CreateTextFile, 77 CScript.exe, 6–7, 13, 17–18 configuring, 51–58 CSng(), 112, 468 CStr(), 112 CTitleBarMsg, 106 CUpperLimit, 106 Currency, 111, 116 CurrentDirectory, 42 D Data assigning, to constants, 104–107 constant, 104–110 constants, list of, 107–108 converting from one data type to another, 112 defined, 103 how scripts view, 103–104 Registry storage of, 323–325 related, 124–135 types, 111 variable, 111–124 Date(), 111, 116, 468 DateAdd(), 468 DateCreated, 76 DateDiff(), 468 DateLastAccessed, 76 DateLastModified, 76 DatePart(), 468 DateSerial(), 468 DateValue(), 468 Day(), 468 DealAnotherCard(), 217, 222–223 DealFirstHand(), 216, 221 defrag.exe, 455–457 Delete(), 77, 249 DeleteFile(), 77, 248, 251 DeleteFolder(), 78, 248, 252–253 Deleting registry keys and values, 327 Description, 42, 194, 355 Desktop administration, 434–437 Desktop execution, 53–54 customizing settings, 56–58 Desktop shortcuts, 193–195 DetermineIfSetIsComplete(), 258, 266 DetermineWinner(), 218, 223–224 Dictionary, 74 Dim, 69, 104, 113, 125 DIR (directory), 11–12 DisconnectObject(), 38, 46 Index Disks cleanup, automatic, 453–455 defragmentation, 455–457 DisplayBoard(), 369, 375 DisplayFinalResults(), 258, 267–268 DisplayGameResults(), 306–307, 369, 376 DisplayName(), 357 DisplaySplashScreen(), 206–208, 218, 225, 258, 268, 369, 383 Do Loop, 69 Double, 111, 116 Do Until, 175, 183–184 Do While, 175, 180–182 DoYouWantToPlay(), 216, 219–220, 297 Drive (object), 74 Drive (property), 76 DriveExists, 78 DriveLetter, 76 Drives, 76 Drives Collection, 74 DriveType, 76 Dynamic arrays, 133–134 E Echo(), 17, 38, 46, 83, 84 Editors, 477–480 Embedding If statements, 150–151 Empty, 111 Endless loops, 182 EnumNetworkDrives(), 46 EnumPrinterConnections(), 46 Environment, 42 Environment variables, 121–124 Equal, 162 Erase, 69 Erasing arrays, 135 Err, 73, 289–290, 354, 362 Error (property), 42 Errors/error messages how to deal with, 286–290 illegal assignment, 105 logical, 280, 285 numbers for, 280, 281, 282–283 preventing, 286 reporting, 291–293 run-time, 279–280, 283–285 syntax, 279, 281–282 understanding, 280–281 Error (variant), 111, 116 Eval(), 468 Event handlers, 288–290 EventLogger.vbs, 50–51 Event procedures, creating, 358–362 Excel spreadsheets, 461–464 Exec(), 46 Execute, 69 Execute(), 46, 355, 367–368 ExecuteGlobal, 69 Execution engines, 6 Execution hosts, 6–7 configuring, 51–58 Exists, 78 Exists(), 46 Exit, 69 ExitCode, 42 Exp(), 468 ExpandEnvironmentStrings(), 46 F File, 74 FileExists(), 78, 238, 248, 250 File extensions, 12 File names, blank spaces in, 55 Files, 76 copying, 248–250 deleting, 248, 249, 251 initialization, 253–257 managing, 248–253 moving, 248, 249, 250 opening and closing, 238–242 reading from, 245–248 writing text to, 242–244 Files Collection, 75 FileSystem, 76 FileSystemObject, 74, 75, 79–81, 235–257 FillArray(), 298, 334–335 Filter(), 468 FirstIndex, 355 FirstLevelValidation(), 302–303 FlipString(), 306 Flowchart, 150 Folder, 75 FolderExists(), 78, 248, 250 Folders copying, 248, 249, 251–252 creating, 248, 251 deleting, 248, 249, 252–253 managing, 248–253 moving, 248, 249, 252 special, 193, 195–197 489 Index . articles and plenty of sample scripts. Microsoft WSH and VBScript Programming for the Absolute Beginner, Second Edition 483 Appendix D • What Next? Figure D.1 The MSDN Scripting page. Figure D.2 The. plenty of sample scripts. Microsoft WSH and VBScript Programming for the Absolute Beginner, Second Edition Figure D.3 WindowsIT Pro Web site. Figure D.4 WSHScripting.com Web site. Another good site is. situations. Locating WSH and VBScript Resources Online There is more to VBScript than can be found in books alone. Much of the information about this topic is free and can be found on the Internet. The following

Ngày đăng: 03/07/2014, 18:20

TỪ KHÓA LIÊN QUAN