Hi Biji,
As I understand, you need to identify an edit box which does not have any unique properties. If so, try using the following code which can be used to identify an object with a specific class by caption of a label located near the object:
function getControl(pnlParent, lblText, classNameSubstr)
{
// Find the label
var lbl = pnlParent.FindChild("wText", lblText, 20000); // If the wText property does not work, try using the Text property or any other property which contains the label's text
// Find the control located to the right of the label
// Set the starting X-coordinate point in the coordinates of the parent panel
var x = lbl.Left + lbl.Width;
var control = null;
for (var i = 0; i < 100; i++)
{
// Move 5 pixels to the right
x += 5;
// Get the object located in the current position
var curObj = Sys.Desktop.ObjectFromPoint(x, lbl.Top + lbl.Height / 2)
// Check whether the current object is a text box
if (curObj.WndClass.indexOf(classNameSubstr) > -1)
{ // The current object is the needed text box
control = curObj;
break;
}
}
return control;
}
function test()
{
// TODO: Assign the container object to the pnlGeneral variable
// The text of the label located to the left of the needed control
var labelText = "My Value:";
// A class name substring which identifies the control as the needed text edit control (modify the substring if necessary)
var controlClass = "TextEdit"
// Try to get the control located to the right of the label with the specified text
var txtMyValue = getControl(pnlGeneral, labelText, controlClass);
if (txtMyValue != null)
{
Log.Message("Object found successfully! See Remarks for more information.", "FullName: " + txtMyValue.FullName);
}
else
{
Log.Error("An object with the '" + controlClass + "' class name located near the '" + labelText + "' label was not found.");
}
}