Welcome to the VanDyke Software Forums

Join the discussion today!

Go Back   VanDyke Software Forums > Scripting

Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
Old 03-27-2019, 10:48 AM
Reno Reno is offline
Registered User
Join Date: Mar 2019
Posts: 35
WaitForStrings with the possibility of different prompts returned

In a VBscript, I'm issuing an SSH command. When that SSH is performed, there are two possibilities:
1) the prompt will change to "[admin@xyz123 ~]$ "
2) the VM will ask for the admin passowrd to complete the SSH, where the prompt will look like:
admin@'s password:

I was trying to figure out how to do a "crt.Screen.WaitForString" where the script waits for either prompt and then takes action based on which prompt is returned.

I'm having a little difficulty getting an example working. From looking at the docs, I was thinking it should look something like:
result = crt.screen.WaitForStrings("admin@'s password: ", "[admin@xyz123 ~]$ ", 10)
If result = 1 Then crt.screen.send "testl"
If result = 2 Then crt.screen.send "test2"
If result = 0 Then
MsgBox "Error: Timed out waiting for prompt!"
End If

Thanks for any help!

Last edited by Reno; 03-27-2019 at 10:49 AM. Reason: tyep-o
Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -6. The time now is 06:52 AM.