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(durationTime)
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 support@rebex.net to get a link to non-trial version of this beta build.