scripting.WaitFor Timeout

0 votes
asked Mar 18, 2015 by Evgenya (470 points)


I'd like to ask additional question related to the timeout.
In case I use the following:

ScriptMatch match = scripting.WaitFor(ScriptEvent.FromString("AAA"));

I try to understand, if my purpose is to make sure that "AAA" sting is expected reply from the server during the first 10 seconds, if not (if response is after 10sec it's not correct for me). What is the way to do it with scripting object
(scriptin.timout, scriptevent.delay and etc...), without using internal timers?
(Please note, during the first 10 seconds the server is responded with different data but not with "AAA")

Thanks in advance,

related to an answer for: Scripting TimeOut Property

1 Answer

+1 vote
answered Mar 19, 2015 by Pavel Matyska (13,340 points)
selected Mar 19, 2015 by Evgenya
Best answer

Hi Evgeny,

unfortunately this kind of operation is not supported in the current version. But, it makes sense to have this feature, so we added this for you. Here you can download the trial beta version with this feature added: Download trial beta build of Rebex Terminal Emulation with Duration ScriptEvent

Here is some small sample code that shows how to wait for a string but for only limited amount of time:

// receive response for 10 second max
ScriptEvent durationTime = ScriptEvent.Duration(10 * 1000);
// wait until a sample text is received during 'duration time'
ScriptMatch match = scripting.WaitFor(durationTime, "sample text");

Then you can check whether the sample code was received or if the duration time was exceeded.

match.IsEventMatched("sample text")

With this approach you can leave the scripting.Timeout property set to valid timeout (usually 2 minutes).

If you have purchased Rebex Terminal Emulation package (or higher) and have active support contract, please mail us to to get a link to non-trial version of this beta build.

commented Apr 9, 2015 by Pavel Matyska (13,340 points)
edited Apr 9, 2015 by Pavel Matyska
We have just release this new ScriptEvent.Duration in release 2015 R3.