Rob van der Woude's Scripting Pages

VBScript Scripting Techniques > Object Browsers

Editors, IDEs & Object Browsers

 

VBSEdit's Object Browser Though simple text editors have served me well both in building my web pages and writing my batch files, I have completely switched to dedicated editors/IDEs for writing VBScript and PowerShell scripts.
Syntax highlighting does help eliminate a lot of debugging time, but what I like even better is "IntelliSense and built-in debuggers and object browsers!

The picture at the right shows VBSEdit's Object Browser window after "instantiating" an Internet Explorer object with this one-liner:

Set objIE = CreateObject( "InternetExplorer.Application" )

It looks a lot like the Object Browser from Visual Studio (Express).

Object browsers don't replace the objects' documentation, but they make finding the right keywords a lot easier, and they can serve as a reminder for the exact syntax.

VBSEdit also comes with its own built-in debugger.

You'll find functionality like that in other editors/IDEs too.

PowerShell scripters should certainly try PowerShell Plus or PowerShell Analyzer.

But of course, instead of using a single integrated environment, you can choose to use separate a editor, debugger and object browser.

Just for fun, copy and paste the following code into your editor with integrated object browser (or IDE), and look what happens to the object browser window:

Set objEmail    = CreateObject( "CDO.Message" )
Set objIE       = CreateObject( "InternetExplorer.Application" )
Set objInet     = CreateObject( "InetCtls.Inet.1" )
Set objHTTP     = CreateObject( "WinHttp.WinHttpRequest.5.1" )
Set objExcel    = CreateObject( "Excel.Application" )
Set objOutlook  = CreateObject( "Outlook.Application" )
Set objPpt      = CreateObject( "PowerPoint.Application" )
Set objWord     = CreateObject( "Word.Application" )
Set objCal      = CreateObject( "MSCAL.Calendar" )
Set objQPro     = CreateObject( "QuattroPro.PerfectScript" )
Set objWP       = CreateObject( "WordPerfect.PerfectScript" )
Set objConn     = CreateObject( "ADODB.Connection" )
Set objRecSet   = CreateObject( "ADODB.Recordset" )
Set objDic      = CreateObject( "Scripting.Dictionary" )
Set objFSO      = CreateObject( "Scripting.FileSystemObject" )
Set wshNetwork  = CreateObject( "WScript.Network" )
Set wshShell    = CreateObject( "WScript.Shell" )
Set objRandom   = CreateObject( "System.Random" )
Set objArrList  = CreateObject( "System.Collections.ArrayList" )
Set objSortList = CreateObject( "System.Collections.SortedList" )
Set xmlDoc      = CreateObject( "Microsoft.XmlDom" )
Set xml2Doc     = CreateObject( "Msxml2.DOMDocument.5.0" )
Set objiTunes   = CreateObject( "iTunes.Application" )
Set objPlayer   = CreateObject( "WMPlayer.OCX" )
Set objWMPlayer = CreateObject( "WMPlayer.OCX.7" )
Set objReal     = CreateObject( "rmocx.RealPlayer G2 Control.1" )
Set objFSDialog = CreateObject( "SAFRCFileDlg.FileSave" )
Set objFODialog = CreateObject( "SAFRCFileDlg.FileOpen" )
Set objDialog   = CreateObject( "UserAccounts.CommonDialog" )
Set SOAPClient  = CreateObject( "MSSOAP.SOAPClient" )
Set objWOL      = CreateObject( "UltraWOL.ctlUltraWOL" )
Set objSearcher = CreateObject( "Microsoft.Update.Searcher" )
Set objShell    = CreateObject( "Shell.Application" )
Note: I added some tooltips to show the minimum requirements for each object, as far as I'm aware.
Just hover over any of the "ProgIDs" to display the tooltip.

 

The following VBScript code can be used to list all available ProgIDs:

Option Explicit

Const HKEY_CLASSES_ROOT = &H80000000

Dim arrProgID, lstProgID, objReg, strMsg, strProgID, strSubKey, subKey, subKeys()

Set lstProgID = CreateObject( "System.Collections.ArrayList" )
Set objReg    = GetObject( "winmgmts://./root/default:StdRegProv" )

' List all subkeys of HKEY_CLASSES_ROOT\CLSID
objReg.EnumKey HKEY_CLASSES_ROOT, "CLSID", subKeys

' Loop through the list of subkeys
For Each subKey In subKeys
	' Check each subkey for the existence of a ProgID
	strSubKey = "CLSID\" & subKey & "\ProgID"
	objReg.GetStringValue HKEY_CLASSES_ROOT, strSubKey, "", strProgID
	' If a ProgID exists, add it to the list
	If Not IsNull( strProgID ) Then lstProgID.Add strProgID
Next

' Sort the list of ProgIDs
lstProgID.Sort

' Copy the list to an array (this makes displaying it much easier)
arrProgID = lstProgID.ToArray

' Display the entire array
WScript.Echo Join( arrProgID, vbCrLf )

 

Notes: Download the complete code in ZIPped format.
Or even better: use ActiveX Helper by Nir Sofer.
  ActiveX Helper screenshot
  Not all of these ProgIDs can be used in VBScript.
  Don't try to load these objects all at once, it might crash your computer.

 

[Back to the top of this page]


page last modified: 2016-09-19; loaded in 0.0022 seconds