Hiding the Drive script in QTP/UFT - hp-uft

Is it possible to hide the Driver script for each execution in HP-UFT?

Instead of using a driver script, you can create the COM object of Quicktest.Application inside your UI application itself. If you are using Excel as UI, you can use the same driver script code in a function and it will work in excel. All languages will have similar methods to create COM objects. A C# example would be this

Related

How can I find the name of a Windows OLE object?

I'm trying to use the Win32::OLE module to control a Windows application. I know that the developers of the application provide an OLE Object to control it, but I don't know the name of the object.
On an old version of the program, I managed to reference the object in Perl by the following line:
$ref = new Win32::OLE 'object.name'
but the new version of the program has a different object name.
Is there any way of checking which OLE objects exist for applications that are currently running on Windows?
Win32::OLE comes with an OLE browser. Keep in mind, it only works with Internet Explorer and only when you load the HTML document from your local system.
Of course, you could also install Microsoft's development tools and get the native OLE/COM Object Viewer:
You can also find the names and components of Win32::OLE objects for other products (Excel, Word) by starting the product, then typing Alt-F11. This should open the VBA editor. Once in the VBA editor, type F2 (or use the pull-down menu from View) to start the Object Browser. This will list the objects relevant to that product. Here is an example from Excel.

QTP AOM Model Intellience Not Working

I want to use QTP AOM(Automation Object Model) using vbscript. I use VbsEdit to develop this script but I did not get any intellience from this editor even I also try this from excel developer window. There also intellence assistance is not available.
I need this because if it is not appear then how can I know the available(open) methods and properties from this COM object.
I have also another question that we write this below line to instantiate a QTP object using vbs
CreateObject("QuickTest.Application")
For excel
CreateObject("Excel.Application")
How can I know the COM objects name means can I list down all COM object name programmatically.
There are two questions here.
Why don't you get intelisense for the QTP object in the IDE you're using (VBSEdit)
Intelisense is a feature of the IDE, you should tag this question VBSEdit, not QTP
Where can I get a list of all the COM objects in the system?
When you use CreateObject you're specifying a ProgID which is a string identifyier for a COM class (slightly more human readable than a CLSID. COM uses the registry to maintain its Prog and Cls IDs, you can find the ProgId's under the HKEY_CLASSES_ROOT registry hive (look for keys with a child CLSID key).

How to simulate typing keyboard keys and <tab> from a BASH script?

I must enter a lot of data into the forms on a workplace Web site. I already have data in a spreadsheet, but must essentially type in the data manually. I would like to create a BASH script which types in the data into the Web browser to save time.
Is it possible to have a BASH script do things like type keys on the keyboard, such as numbers, and [tab], while focused on my browser window? With this, I could easily create a BASH script which automatically enters the data I need.
The answer in Is there a way to trigger a Hot Key/Keyboard Shortcut via a Shell Script, a AppleScript or a Automator Workflow? useful, but is only for OS X, while I use Debian.
You can get it importing "Selenium" in java / python... code.
You are interested in method sendKeys.
Here is an example:
WebElement.sendKeys(Keys.RETURN);
You can encapsulate Selenium's calls in a small java code that you call from a shell script, keeping the logic in your script.

how to get the .tsr file in QTP

We all know that the .tsr file stores the information of the object repository, and We can load the file to an ObjectRepositoryUtil Object in VBS, then we can do a lot through this object.
But how can I capture all the widgets in a window and stores into the .tsr file using VBS?
I mean when we do the following in the QTP GUI:
Resources->Object Repository Manager->Object->Add Object->
"CLICK THE WINDOW WE WANT TO CAPTURE"->File->Save
we actually get the .tsr file of the window and all its components we want to capture.
But how can I do this in VBS, does it have any API?
I look up the document called ObjectRepositoryUtil and find the method GetAllObjects, but it is just not the same thing.
Could anyone solve my problem ? I would really appreciate it.
Thank you.
I'm not sure why you want to automate creating an object repository. Usually object repositories are created once and then used for creating tests.
Are you familiar with QTP's Navigate and Learn feature, it allows adding all objects from an application while interacting with the application.
If you are looking for a tool or code that can actually mimic the object capturing capability of QTP, outside of QTP - then no such tool/code is available as of now. However code can be written to retrieve the object properties of an application and that I assume you are aware of.

Read keypress using JScript

I am trying to do a simple JScript using the Windows Script Host (outside any browser, was my intent) to read users keypresses, but can't find a way to do what amounts to:
function tap(e) {
...code...
}
document.onkeypress = tap;
I'm no Windows systems programming guy (but a seasoned programmer) so I'm unfamiliar with ActiveX gadgets and services and the like. Doesn't WScript or WSShell provide a way to open a window (instead of the 'document')?
Or am I forced to run this from a browser to make it work? Seems overkill...
Windows Scripting Host doesn't provide any UI, well, not a GUI at least.
If you use CScript.exe then you can use StdIn, StdOut, etc. See Wscript.StdIn.Read method.
These are most of the objects available for Windows Scripting Host: main WSH objects, the dictionary and FileSystem objects come in handy: Dictionary and FileSystem objects
But if you want a GUI, then you can run an HTA file in MSHTA.exe and use HTML/CSS/JavaScript to handle your UI needs and still use the WSH objects.
Overkill? Well, list what you want from your UI. Now, you'd have to provide a mechanism for accessing all those features. And your example code shows you'd want to do it in a HTML-DOM-via-JavaScript-like manner. So, you'd need an HTML parser and DOM support. Looks like you want access to most of what a browser provides at that point.
Try
var tap = function (e) {
...code...
}
document.onkeypress = tap;
I don't think the Windows Script Host provides an API for keyboard hooks. The most reliable way to do this may be to create a COM component that implements a keyboard hook (in C#/C++, for example) and use an instance of that object in JScript as needed.

Resources