Morgan
11 years agoFrequent Contributor
Incrementing an action
I'm trying to create a little script that loops through a dropdown to find the desired value. Can someone direct me as to an example?
Thanks,
Morgan
I'm trying to create a little script that loops through a dropdown to find the desired value. Can someone direct me as to an example?
Thanks,
Morgan
Initial code looks as follows.... what's not working is that the [Down] needs to increment each time. So first time, one down action is needed, second 2, etc...
Thanks!
Morgan
----
repeat // If X appears in the list, we select it and continue.
grdAnalyte.Keys(' ');
grdAnalyte.Keys('[Down][Enter]');
Delay(Std_Wait);
until frmAnalyte.Window('TDBGridInplaceEdit', '', 1).text = 'X';
until frmAnalyte.Window('TDBGridInplaceEdit', '', 1).text = 'X';
Is this a custom control similar to a Win32 ComboBox? If so, I would think that if you instantiate a variable of that type, then that would expose the item count for the dropdown similar to the method in the TestComplete Working with dropdowns support article:
procedure Main();
var
p, w, ComboBox: OleVariant;
begin
// Run Notepad
Win32API.WinExec('notepad.exe', SW_SHOWNORMAL);
// Obtain a combo box object
p := Sys.Process('NOTEPAD');
Sys.Keys('~of');
w := Sys.Process('NOTEPAD').Window('#32770', 'Font', 1);
ComboBox := w.Window('ComboBox', '', 5);
// Post the total number of items to the log
Log.Message('The total number of items:' + aqConvert.IntToStr(ComboBox.wItemCount));
end;
you could put the call to [Down] in a loop and increment the times that loop is executed each time it is called.
in pseudo code:
maxLoop = 0
repeat // If X appears in the list, we select it and continue.
maxLoop++
grdAnalyte.Keys(' ');
for (i=0; i < maxLoop; i++) {
grdAnalyte.Keys('[Down][Enter]');
}
Delay(Std_Wait);
Hmmm... I think I get what you are saying but I'm having trouble converting it to DelphiScript. Any ideas?
Appreciate the help!
Morgan