Forum Discussion
kirk_bottomley
11 years agoContributor
Nice one, Hagai.
I've got one in JScript I use before sending keys to a text object. Pass in whatever property you want to search for the text field with (I usually use Name, frequently with wildcards), the parameter, and the process. It also has to be a visible object.
function ClearTextObject(ByProperty, Parameter, ProcessName)
{
var PropArray, ValuesArray, Process, Target;
var Depth = 5;
PropArray = new Array(ByProperty, "Visible");
ValuesArray = new Array(Parameter, true);
Process = Sys.Process(ProcessName);
Target = Process.FindChild(PropArray, ValuesArray, Depth);
try
{
if (Target.Exists)
{
var Text = Target.Text;
var Length = Text.length;
Target.Click();
Target.Keys("[End]");
Indicator.PushText("Backspacing the text away.");
for (i = 0; i < Length; i++)
{
Target.Keys("[BS]");
}
Indicator.PopText();
}
else
Log.Error("The object was not found.");
}
catch (err)
{
Log.Error(err.description)
}
}jsc
11 years agoRegular Contributor
you can try
Obj.Keys("^aMyText")
so all text is selected (^a) and replaced withy "MyText"
Or Obj.SetText("MyText")