There are various Object Models that help VBScript interact with a certain group of objects. This can be exetremely useful in your test scripts.
COM is used to help interact with Microsoft objects. COM objects includes Microsoft technologies like: OLE, OLE Automation, ActiveX, COM+, DCOM, the Windows shell, DirectX, and Windows Runtime. COM helps us interact with Microsoft Objects like Word, Access, Excel, Outlook, Internet Explorer, and the Windows File System Object.
First we must create an instance of the object we want to use:
Here are some examples:
Once you have created the object you can always type the name and then a period (I.E. "myExcel.") and then the list of available methods will pop up.
Here is an example of what you can do with the Excel object:
You can use WSH to run applications, manipulate the contents of the registry, or send keyboard input.
Here is an example of using the WSH object model to send keyboard input:
Here is an example of using WSH to run an aplication:
You can use DOM to interact with objects in HTML, XHTML, and XML documents. So think web applications.
Here are some examples of what you can do using DOM:
You can use AOM to load all the required add-ins for a test, make QTP visible while execution, opens the test using the specified location, associates function libraries, setting the common object sync time out, start and end iteration, enable/disable smart identification, on error settings, data table path, recovery scenario settings, and log tracking settings. So you can use AOM objects to help automate configurations for your test script.
HP offers really good documentation about AOM. Go to Start -> All Programs -> HP QuickTest Professional -> Documentation -> QuickTest Automation Reference.
There are a few places you can create AOM scripts. Go to the various places you can specify settings and look for a "Generate Script" button.
This will create a vbscript file that can be used to open up QTP with the settings that are currently selected.