Back to product page

Prompt property


Holds command prompt string to expect from server.

Type

String

Syntax

  • Basic
object.Prompt [= value]
The Prompt(object) syntax has these parts:
objectAn expression evaluating to an object of type wodTelnetDLX

Remarks

Prompt property allows wodTelnetDLX to have 'a feature' to determine if last executed command (and it's output) finished, so new commands are to be executed. If you have more than one command to execute on remote server, you will find this feature handy. When you set this property, wodTelnetDLX will fire PromptReceived event each time it recognizes command prompt sequence.

Take an example: try to connect to your server. After connection is established, you will receive something like this:
 
telnet some.host.com
Trying some.host.com...
Connected to 192.168.1.10.
Escape character is '^]'.
 
linux login: joe
Password:
 
Linux 2.4.5. Last login: Sat Jan 26 2002 on pts/0 from mainframe.
No mail.
joe@somehost:-$

note here that sequence joe@somehost: represents command prompt string that will be returned by server each time it expects new command. To be even more certain, you can add CRLF sequence before it. So, if you set Prompt = "joe@somehost:" then each time wodTelnetDLX finds this sequence it will fire PromptReceived event. Here, you can execute new command, and wait for it's output.

If Prompt property is set, the command prompt string you entered will not be provided through Received event - which means you don't have to 'cut it off' from command output.

You can also provide regular expression to be searched in received data instead of exact value. You should prepend your Prompt property with regex: text so wodTelnetDLX knows you are using regular expression.

For example, you can use it like this:
 
Telnet1.HostName = "some.host.com"
Telnet1.Login = "joe"
Telnet1.Password = "secretpass"
Telnet1.Protocol = SSHAuto
Telnet1.Prompt = "regex:[\$%#] $"
Telnet1.Connect
 

above regular expression will match when:
  • $, %, #, or > is found
  • space
  • end of line
typically, our previous sample joe@somehost:-$<SPACE> does match above regex. But, hey, feel free to use something more complex such as:
 
Debug.Print Telnet1.Execute("cd /tmp" & VbLf, "regex:[a-zA-z0-9]+@[a-zA-z0-9]+:[a-zA-z0-9-/]+[\$%#] $")
 

or using extended PERL syntax
 
Debug.Print Telnet1.Execute("cd /tmp" & VbLf, "regex:\w+@\w+:\S+\$ $")
 

just don't forget to put regex: text in front of regular expression, otherwise wodTelnetDLX will search for exact match of specified pattern. PCRE (www.pcre.org) library is used for regex support.

Platforms

Windows