Hi Herman,
I agree with Ory: it looks like the problem is caused by unreliable properties in your Name Mapping scheme. Try using more reliable properties to identify the problematic objects and avoid using indexes as the indexes can change during your script execution. If other recognition criteria are absolutely unreliable, I recommend that you use the Left and Top properties to identify the objects by their coordinates.
If this approach does not help you either, the only thing which remains is to identify the needed object by other objects located near the object. However, note that identifying an object by another object located near this object is a task which will require some scripting. You can implement a script similar to the following script (the script finds an object of the specified class located to the right of a label with the specific text on a specific panel):
[JScript]
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 to the right for 5 pixels
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.ClrClassName.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 this is 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.");
}
}