Back to Blog

Vugen: RTE Protocol Wait/Polling Routine

While it isn’t the most popular protocol out there, RTE (terminal emulation) continues to serve a need for those testing against “green screen” apps, AS400’s, etc…There are times where you may be waiting on a particular string of text to show up on a screen. You may want to continue polling until the text is there. The script below gives you one idea of how to do this. Note that the X/Y coordinates and field length will be different based on your screen and what you are looking for.

int rc, i;
char match[80];

// Grab some text, store it in var match and log result

TE_get_text_line (3,15,5, match); 

// You must modify col/row coordinates

lr_output_message("Found: %s",match);

// Wait until "text" message disappears
// within 1 second of message disappearing, loop will end

 i = 0;
 do {
 rc = strncmp( match, "text" , 5);
 if (rc == 0){
 i++; // increment sec counter
 lr_think_time(1);
 lr_output_message("still waiting...");
 TE_get_text_line (3,15,5, match);
 }
 } while (rc == 0);
 lr_output_message("Waited %d seconds for: %s",i,"text");

 

Back to Blog