Thursday, April 7, 2011

VBScript Object Commands



VBScript includes several Functions and Statements that can be used to access objects, including their methods and properties. There are a large variety of objects available to VBSript, including user defined objects, intrinsic objects and extrinsic objects.


VBScript Object Functions

  • CreateObject Creates and returns a reference to an Automation object

  • GetObject Returns a reference to an Automation object from a file

  • IsObject Returns a Boolean value indicating whether an expression references a valid Automation object.

Object Statements

Class Declares the name of a class, as well as a definition of the variables, properties, and methods that comprise the class

Exit Property Forces an exit from inside a Property Set function.

For each…Next repeats a group of statements for each element in an array or a collection.

Property Get Declares, in a Class block, the name, arguments, and code that form the body of a Property procedure that gets (returns) the value of a property

Property Let Declares, in a Class block, the name, arguments, and code that form the body of a Property procedure that assigns (sets) the value of a property

Property Set Sets a reference to an object

Set Assigns an object reference to a variable or property, or associates a procedure reference with an event. Usually used to instantiate an object.

Error Handling Statements

On Error Enables or disables error-handling



Object & Collection Summary

  • Debug The Debug object is an intrinsic global object that can send an output to a script debugger, such as the Microsoft Script Debugger.

  • Dictionary An associative array that can store any type of data. Data is accessed by a key.

  • Drives A collection of Drive objects.

  • Err Contains information about the last run-time error. Accepts the Raise and Clear
  • methods for generating and clearing run-time errors.

  • File An object that refers to a specific File

  • Files A collection of File objects.

  • FileSystemObject An object model used to access the Windows file system

  • Folder An object that refers to a specific Folder

  • Folders A collection of Folder objects.

  • Match Provides access to the read-only properties of a regular expression match.

  • Matches Collection of regular expression Match objects.

  • RegExp Provides simple regular expression support.

  • Submatches A collection of regular expression submatch strings.

  • TextStream An object that refers to a text File

No comments:

Post a Comment