Hello, thank you for the log. After analyzing that log it seems that your server is not supported with the DetectPrompt()
method. DetectPrompt()
expects that when the ENTER is sent, the prompt appears right below the current line. Unfortunately, in your case the server sends empty line and then the prompt. This is not supported scenario yet. We might add it in the future.
For now, you can detect it with the Scripting API yourself. You may begin with this code:
private static void DetectPrompt(Scripting script)
{
string promptLine = "";
while (true)
{
string line = script.ReadUntil(">" & ScriptEvent.Delay(300));
line = line.TrimStart();
if (line != promptLine)
{
script.Send(FunctionKey.Enter);
promptLine = line;
}
else
{
script.Prompt = "string:" + promptLine;
break;
}
}
}
You may need change the delay time or add a check to break the loop after few attempts.
If your prompt can end with other characters than ">", you can use a regular expression to describe the prompt ending. E.g. if the prompt can end with ">", "$" or "#", use this code:
string line = script.ReadUntil(ScriptEvent.FromRegex("[>$#]") & ScriptEvent.Delay(300));
Scripting.DetectPrompt() uses script.Terminal.Screen.GetRegionText(...)
to determine what the sent ENTER did with the terminal screen. You can try this approach as well.