Vbscript Programmer's Reference

Total Page:16

File Type:pdf, Size:1020Kb

Vbscript Programmer's Reference Table of Contents VBScript Programmer's Reference...................................................................................................................1 Introduction.........................................................................................................................................................6 Who is this Book For?............................................................................................................................6 How to Use this Book.............................................................................................................................6 What is VBScript?..................................................................................................................................7 What Can You Do With VBScript?......................................................................................................11 What Tools Do You Need to Use VBScript?.......................................................................................14 What's New in VBScript 5?..................................................................................................................15 Code Conventions.................................................................................................................................17 Tell Us What You Think.......................................................................................................................17 Customer Support.................................................................................................................................18 Chapter 1: A (Very) Short Introduction to Programming..........................................................................19 Overview...............................................................................................................................................19 Variables and Data Types.....................................................................................................................19 Control of Flow.....................................................................................................................................23 Operators...............................................................................................................................................31 Organizing and Reusing Code..............................................................................................................32 Top−Down vs. Event Driven................................................................................................................35 Some Guidelines to Keep in Mind........................................................................................................37 Suggestions for Further Reading..........................................................................................................39 Chapter 2: Variables and Data Types............................................................................................................40 The Visual Basic Data Types................................................................................................................40 The Variant: VBScript's Only Data Type.............................................................................................42 Variables in VBScript...........................................................................................................................60 Literals and Named Constants..............................................................................................................65 Complex Data Types.............................................................................................................................69 Chapter 3: Control of Flow.............................................................................................................................77 Branching Constructs............................................................................................................................77 Loop Constructs....................................................................................................................................81 Chapter 4: Error Handling, Prevention and Debugging.............................................................................93 Overview...............................................................................................................................................93 Introduction...........................................................................................................................................93 Seeing the Error of your Ways..............................................................................................................94 Different Types of Errors......................................................................................................................98 What Can We Do About Errors?........................................................................................................105 Debugging...........................................................................................................................................120 Common Errors and How To Avoid Them........................................................................................127 Summary.............................................................................................................................................128 Chapter 5: Using COM Components and Objects.....................................................................................129 Overview.............................................................................................................................................129 Introduction to COM components and Objects..................................................................................129 Object and Object Interfaces...............................................................................................................131 What COM Components and Objects are Available?........................................................................137 Objects and the Variant data type.......................................................................................................138 i Table of Contents Chapter 5: Using COM Components and Objects Properties and Methods.......................................................................................................................139 Object Scope, Lifetime and References..............................................................................................141 Using the With Statement with Objects..............................................................................................145 Create your own COM Objects...........................................................................................................146 Summary.............................................................................................................................................146 Chapter 6: Using COM Components with MTS.........................................................................................147 Overview.............................................................................................................................................147 A Quick Introduction to MTS.............................................................................................................147 Advantages of using MTS..................................................................................................................149 Next Step: COM+...............................................................................................................................158 Summary.............................................................................................................................................160 Chapter 7: The Built−In and Scripting Runtime Objects..........................................................................162 Overview.............................................................................................................................................162 Runtime vs. Built−In − What's the Difference?..................................................................................162 Built−In Objects..................................................................................................................................162 Regular Expressions............................................................................................................................163 Scripting Runtime Objects..................................................................................................................173 Summary.............................................................................................................................................182 Chapter 8: Classes in VBScript (Writing Your Own COM Objects).......................................................183 Classes vs. Objects vs. Components...................................................................................................183 Chapter 9: Windows Script Components....................................................................................................204 What Are Windows Script Components?...........................................................................................204 What Tools Do You Need?.................................................................................................................204
Recommended publications
  • HOL: Building Solutions Using Microsoft Office Infopath 2003
    Hands-On Lab Lab Manual Building Solutions using Microsoft Office InfoPath 2003 Please do not remove this manual from the lab The lab manual will be available from CommNet Release Date: April 2005 m Information in this document is subject to change without notice. The example companies, organizations, products, people, and events depicted herein are fictitious. No association with any real company, organization, product, person or event is intended or should be inferred. Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of this document may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of Microsoft Corporation. Microsoft may have patents, patent applications, trademarked, copyrights, or other intellectual property rights covering subject matter in this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual property. ©2005 Microsoft Corporation. All rights reserved. Microsoft, MS-DOS, MS, Windows, Windows NT, MSDN, Active Directory, BizTalk, SQL Server, SharePoint, Outlook, PowerPoint, FrontPage, InfoPath, Visual Basic, Visual C++, Visual J++, Visual InterDev, Visual SourceSafe, Visual C#, Visual J#, and Visual Studio are either registered trademarks or trademarks of Microsoft Corporation in the U.S.A. and/or other countries. Other product and company names herein may be the trademarks of their respective owners. Notes Page 2 HOL: Building Solutions using Microsoft Office InfoPath 2003 HOL: Building Solutions using Microsoft Office InfoPath 2003 This lab will help turn you into a knowledgeable developer of InfoPath 2003 form solutions.
    [Show full text]
  • Learning React Functional Web Development with React and Redux
    Learning React Functional Web Development with React and Redux Alex Banks and Eve Porcello Beijing Boston Farnham Sebastopol Tokyo Learning React by Alex Banks and Eve Porcello Copyright © 2017 Alex Banks and Eve Porcello. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://oreilly.com/safari). For more information, contact our corporate/insti‐ tutional sales department: 800-998-9938 or [email protected]. Editor: Allyson MacDonald Indexer: WordCo Indexing Services Production Editor: Melanie Yarbrough Interior Designer: David Futato Copyeditor: Colleen Toporek Cover Designer: Karen Montgomery Proofreader: Rachel Head Illustrator: Rebecca Demarest May 2017: First Edition Revision History for the First Edition 2017-04-26: First Release See http://oreilly.com/catalog/errata.csp?isbn=9781491954621 for release details. The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. Learning React, the cover image, and related trade dress are trademarks of O’Reilly Media, Inc. While the publisher and the authors have used good faith efforts to ensure that the information and instructions contained in this work are accurate, the publisher and the authors disclaim all responsibility for errors or omissions, including without limitation responsibility for damages resulting from the use of or reliance on this work. Use of the information and instructions contained in this work is at your own risk. If any code samples or other technology this work contains or describes is subject to open source licenses or the intellectual property rights of others, it is your responsibility to ensure that your use thereof complies with such licenses and/or rights.
    [Show full text]
  • Xcentrisity® BIS Addpack for Visual COBOL
    Xcentrisity® BIS AddPack for Visual COBOL User's Guide Micro Focus The Lawn 22-30 Old Bath Road Newbury, Berkshire RG14 1QN UK http://www.microfocus.com © Copyright 2009-2020 Micro Focus or one of its affiliates. MICRO FOCUS, the Micro Focus logo and Visual COBOL are trademarks or registered trademarks of Micro Focus or one of its affiliates. All other marks are the property of their respective owners. 2020-06-17 ii Contents Xcentrisity Business Information Server for Visual COBOL User's Guide ............................................................................................................................. 5 Copyright and Trademarks .................................................................................................. 5 Introducing the Business Information Server ...................................................................... 5 Overview .................................................................................................................. 6 Installation on Windows ............................................................................................7 Installation on UNIX ..................................................................................................9 Testing the Installation ............................................................................................11 Uninstalling BIS for IIS ........................................................................................... 11 Uninstalling BIS for Apache ....................................................................................12
    [Show full text]
  • HTTP Cookie - Wikipedia, the Free Encyclopedia 14/05/2014
    HTTP cookie - Wikipedia, the free encyclopedia 14/05/2014 Create account Log in Article Talk Read Edit View history Search HTTP cookie From Wikipedia, the free encyclopedia Navigation A cookie, also known as an HTTP cookie, web cookie, or browser HTTP Main page cookie, is a small piece of data sent from a website and stored in a Persistence · Compression · HTTPS · Contents user's web browser while the user is browsing that website. Every time Request methods Featured content the user loads the website, the browser sends the cookie back to the OPTIONS · GET · HEAD · POST · PUT · Current events server to notify the website of the user's previous activity.[1] Cookies DELETE · TRACE · CONNECT · PATCH · Random article Donate to Wikipedia were designed to be a reliable mechanism for websites to remember Header fields Wikimedia Shop stateful information (such as items in a shopping cart) or to record the Cookie · ETag · Location · HTTP referer · DNT user's browsing activity (including clicking particular buttons, logging in, · X-Forwarded-For · Interaction or recording which pages were visited by the user as far back as months Status codes or years ago). 301 Moved Permanently · 302 Found · Help 303 See Other · 403 Forbidden · About Wikipedia Although cookies cannot carry viruses, and cannot install malware on 404 Not Found · [2] Community portal the host computer, tracking cookies and especially third-party v · t · e · Recent changes tracking cookies are commonly used as ways to compile long-term Contact page records of individuals' browsing histories—a potential privacy concern that prompted European[3] and U.S.
    [Show full text]
  • Aspects of AJAX
    Aspects of AJAX Aspects of AJAX Published online at http://www.mathertel.de/AJAX/AJAXeBook.aspx By Matthias Hertel, 2005•2007 Version 1.2 published 1. May 2007 1 Aspects of AJAX About this book This book is about an AJAX Framework and an AJAX Engine for JavaScript, XML, SOAP, WSDL und ASP.NET using standard Web Services on the server. This book is containing the updated articles and samples from my Blog "Aspects of AJAX", available at http://ajaxaspects.blogspot.com/ together with some new and rewritten articles. The implementation of the Samples, the AJAX Engine and a lot of web controls can be found on http://www.mathertel.de/AJAXEngine/. The License This book and all the articles on my blog are licensed under a Creative Commons Attribution 2.0 License that can be found at http://creativecommons.org/licenses/by/2.0/de/. The software itself is licensed under a BSD style license that can be found at http://www.mathertel.de/License.aspx. State of this book This book is still not finished and will be updated and extended from time to time. You will find more information when reading the Blog or downloading a new copy of this book. There are still a lot of aspects undocumented or undiscovered. State of the Software The AJAX engine is working fine in many projects I do myself and I’ve heard about and you can use it where ever you want. The license model I’ve chosen to publish the information and the source code allows also a commercial use of it.
    [Show full text]
  • Getting Started with Windows Scripting
    Getting Started with Windows Scripting art I of the PowerShell, VBScript, and JScript Bible intro- IN THIS PART duces you to the powerful administrative tool that is Windows scripting. You’ll get an overview of Windows Chapter 1 P Introducing Windows Scripting scripting and its potential, and an introduction to three tech- nologies you can use for Windows scripting: VBScript, JScript, Chapter 2 and PowerShell. VBScript Essentials Chapter 3 JScript Essentials Chapter 4 PowerShell Fundamentals COPYRIGHTED MATERIAL 886804c01.indd6804c01.indd 1 11/21/09/21/09 11:16:17:16:17 PPMM 86804c01.indd 2 1/21/09 1:16:18 PM Introducing Windows Scripting indows scripting gives everyday users and administrators the ability to automate repetitive tasks, complete activities while IN THIS CHAPTER away from the computer, and perform many other time-saving W Introducing Windows scripting activities. Windows scripting accomplishes all of this by enabling you to create tools to automate tasks that would otherwise be handled manually, Why script Windows? such as creating user accounts, generating log files, managing print queues, or examining system information. By eliminating manual processes, you Getting to know can double, triple, or even quadruple your productivity and become more Windows Script Host effective and efficient at your job. Best of all, scripts are easy to create and Understanding the Windows you can rapidly develop prototypes of applications, procedures, and utili- scripting architecture ties; and then enhance these prototypes to get exactly what you need, or just throw them away and begin again. This ease of use gives you the flex- ibility to create the kinds of tools you need without a lot of fuss.
    [Show full text]
  • Market-Driven Framework for Guiding Optimisation Decisions in Embedded Systems Master of Science Thesis in the Software Engineering Programme
    Market-Driven Framework for Guiding Optimisation Decisions in Embedded Systems Master of Science Thesis in the Software Engineering Programme Sofia Charalampidou Paschalis Tsolakidis Chalmers University of Technology University of Gothenburg Department of Computer Science and Engineering Göteborg, Sweden, August 2013 The Author grants to Chalmers University of Technology and University of Gothenburg the non- exclusive right to publish the Work electronically and in a non-commercial purpose make it accessible on the Internet. The Author warrants that he/she is the author to the Work, and warrants that the Work does not contain text, pictures or other material that violates copyright law. The Author shall, when transferring the rights of the Work to a third party (for example a publisher or a company), acknowledge the third party about this agreement. If the Author has signed a copyright agreement with a third party regarding the Work, the Author warrants hereby that he/she has obtained any necessary permission from this third party to let Chalmers University of Technology and University of Gothenburg store the Work electronically and make it accessible on the Internet. Market-Driven Framework for Guiding Optimisation Decisions in Embedded Systems Sofia Charalampidou, Paschalis Tsolakidis © Sofia Charalampidou, August 2013. © Paschalis Tsolakidis, August 2013. Examiner: Richard Torkar Supervisors: Christian Berger (Chalmers), Tobjörn Mattsson (Mecel AB) Chalmers University of Technology University of Gothenburg Department of Computer Science and Engineering SE-412 96 Göteborg Sweden Telephone + 46 (0)31-772 1000 Department of Computer Science and Engineering Göteborg, Sweden August 2013 Market Driven Framework for Guiding Optimisation Decisions in Embedded Systems CHALMERS UNIVERSITY OF TECHNOLOGY Department of Computer Science and Engineering Abstract The recent need for web connectivity in the embedded systems domain and in particular the In-Vehicle Infotainment (IVI), has fired discussions about the integration of HTML components in these systems.
    [Show full text]
  • Tyson Kopczynski
    www.it-ebooks.info Tyson Kopczynski Windows® PowerShell UNLEASHED 800 East 96th Street, Indianapolis, Indiana 46240 USA www.it-ebooks.info Windows® PowerShell Unleashed Editor-in-Chief Copyright © 2007 by Sams Publishing Karen Gettman All rights reserved. No part of this book shall be reproduced, stored in a retrieval system, or transmitted by any means, electronic, mechanical, photocopying, recording, Senior Acquisitions or otherwise, without written permission from the publisher. No patent liability is Editor assumed with respect to the use of the information contained herein. Although every Neil Rowe precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions. Nor is any liability assumed for Development Editor damages resulting from the use of the information contained herein. Mark Renfrow International Standard Book Number: 0-672-32953-0 Managing Editor Library of Congress Cataloging-in-Publication Data Gina Kanouse Kopczynski, Tyson. Project Editor Microsoft PowerShell unleashed / Tyson Kopczynski. George E. Nedeff p. cm. ISBN 0-672-32953-0 Copy Editor 1. Microsoft Windows (Computer file) 2. Operating systems (Computers) I. Title. Lisa M. Lord QA76.76.O63K66 2007 Senior Indexer 005.4’46—dc22 Cheryl Lenser 2007008894 Proofreader Printed in the United States of America Water Crest First Printing: Publishing 10090807 4321 Contributing Authors Trademarks Pete Handley, Mark All terms mentioned in this book that are known to be trademarks or service marks Weinhardt, and have been appropriately capitalized. Sams Publishing cannot attest to the accuracy of this information. Use of a term in this book should not be regarded as affecting the Josh Tolle validity of any trademark or service mark.
    [Show full text]
  • Microsoft AJAX Library Essentials Client-Side ASP.NET AJAX 1.0 Explained
    Microsoft AJAX Library Essentials Client-side ASP.NET AJAX 1.0 Explained A practical tutorial to using Microsoft AJAX Library to enhance the user experience of your ASP.NET Web Applications Bogdan Brinzarea Cristian Darie BIRMINGHAM - MUMBAI Microsoft AJAX Library Essentials Client-side ASP.NET AJAX 1.0 Explained Copyright © 2007 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, Packt Publishing, nor its dealers or distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. First published: July 2007 Production Reference: 1230707 Published by Packt Publishing Ltd. 32 Lincoln Road Olton Birmingham, B27 6PA, UK. ISBN 978-1-847190-98-7 www.packtpub.com Cover Image by www.visionwt.com Table of Contents Preface 1 Chapter 1: AJAX and ASP.NET 7 The Big Picture 8 AJAX and Web 2.0 10 Building
    [Show full text]
  • Technologies for Connecting and Using Databases and Server Applications on the World Wide Web
    Technologies for Connecting and Using Databases and Server Applications on the World Wide Web by Adolfo G. Castellon Jr. Submitted to the Department of Electrical Engineering and Computer Science on May 23, 1997, in partial fulfillment of the requirements for the degree of Bachelor of Science in Computer Science Abstract This paper presents a study of current technologies used to build applications that make use of the World Wide Web. In particular, this paper discusses three different technologies (Java Beans, OLE/ActiveX and CORBA) born of very different heritage, that are evolving towards a common goal. The emphasis is on technologies that have been recently developed to connect databases to Web applications. Two applications created by the author are used to demonstrate specific types of emerging web technologies. Thesis Supervisor: Dr. Amar Gupta Title: Co-Director, Productivity from Information Technology (PROFIT) Initiative Table of Contents 1 Introduction..............................................................................................................................................................3 1.1 Overview...................................................................................................................................................... ..................................................................................................................................................................3 1.2 Conventions: How to Read This Document.........................................................................................
    [Show full text]
  • Vbscript Programmer’S Reference Third Edition
    VBScript Programmer’s Reference Third Edition Adrian Kingsley-Hughes Kathie Kingsley-Hughes Daniel Read Wiley Publishing, Inc. ffirs.indd iii 8/28/07 9:41:21 AM ffirs.indd vi 8/28/07 9:41:22 AM VBScript Programmer’s Reference Third Edition Introduction . xxv Chapter 1: A Quick Introduction to Programming . 1 Chapter 2: What VBScript Is — and Isn’t! . 31 Chapter 3: Data Types . 45 Chapter 4: Variables and Procedures . 83 Chapter 5: Control of Flow . 109 Chapter 6: Error Handling and Debugging . 129 Chapter 7: The Scripting Runtime Objects . 183 Chapter 8: Classes in VBScript (Writing Your Own COM Objects) . 209 Chapter 9: Regular Expressions . 233 Chapter 10: Client-Side Web Scripting . 261 Chapter 11: Windows Sidebars and Gadgets . 287 Chapter 12: Task Scheduler Scripting . 309 Chapter 13: PowerShell . 345 Chapter 14: Super-Charged Client-Side Scripting . 375 Chapter 15: Windows Script Host . 405 Chapter 16: Windows Script Components . 465 Chapter 17: Script Encoding . 489 Chapter 18: Remote Scripting . 509 Chapter 19: HTML Applications . 517 Chapter 20: Server-Side Web Scripting . 535 Chapter 21: Adding VBScript to Your VB and .NET Applications . 569 (Continued) ffirs.indd i 8/28/07 9:41:21 AM Appendix A: VBScript Functions and Keywords . 603 Appendix B: Variable Naming Convention . 675 Appendix C: Coding Conventions . 677 Appendix D: Visual Basic Constants Supported in VBScript . 681 Appendix E: VBScript Error Codes and the Err Object . 687 Appendix F: The Scripting Runtime Library Object Reference . 703 Appendix G: The Windows Script Host Object Model . 715 Appendix H: Regular Expressions . 723 Appendix I: The Variant Subtypes .
    [Show full text]
  • Blocked Attachments in Outlook Page 1 of 5
    Blocked attachments in Outlook Page 1 of 5 Outlook > Attachments Blocked attachments in Outlook To help protect your computer, Microsoft Office Outlook does not allow you to receive files of certain types (such as .exe files) as attachments, because of their potential for introducing a virus into your computer. Outlook blocks these files by default. If your organization uses Microsoft Exchange, only the e-mail server administrator can unblock these file types. End users of Outlook cannot unblock these file types. In this article Background - The Internet is a dangerous neighborhood How to share your files safely Attachment file types blocked by Outlook Background - The Internet is a dangerous neighborhood When Microsoft Outlook 97 first arrived on the market, the Internet still seemed like a relatively safe place, and sending attachments in e-mail seemed like a great idea. But then — beginning in March of 1999 when the Melissa virus struck, only to be followed by the ILOVEYOU virus — reality hit hard. These were the fastest-spreading viruses ever seen up to that time, and they forced a number of companies to shut down their e-mail systems, at significant cost. In order to spread, these attacks relied heavily on fooling people into believing that infected e-mail messages were coming from someone familiar, and even many computer experts fell victim to them and became infected. It is no secret that hackers like to attack the largest available target — and today, that is Microsoft Office Outlook. World wide, more than 300 million people use Outlook. Therefore, the industry and Microsoft customers look to Microsoft to provide protection against security threats.
    [Show full text]