Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Reply
 
Thread Tools Rate Thread Display Modes
  #16  
Old 07-20-2017, 06:56 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 3,098
Hi jatcase,

Unless sensitive data, I want to know what is the prompt, specifically?

If it's sensitive data then just say "hostname of device", followed by # or $ or >.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #17  
Old 07-26-2017, 08:21 PM
jatcase jatcase is offline
Registered User
 
Join Date: Jul 2017
Posts: 9
sorry i've been full with work this few days, i will work with it this weekend

Best regards
Reply With Quote
  #18  
Old 07-28-2017, 12:04 PM
dayton967 dayton967 is offline
Registered User
 
Join Date: Apr 2005
Posts: 7
This should work

In the ReadString(String) Method, the string, refers to the point to stop processing the Input, so if you enter what you are looking for, as the String it will give you everything before this, which is the command, you entered.

This below should work.

Code:
Sub Main

'variables devices/ports'
	Dim hl, rglobal, local, puertosl, puertosg, resultadoshow, screenrow, currentrow
'show command'
	show = "show host | include "
'variables username/pass'
	Dim password
	username = "cisco"
	crt.Screen.Synchronous = True

'Telnet the device'
	crt.Session.Connect "/TELNET 127.0.0.1 5000"
' Wait for the device's login prompt or for 2 seconds whichever comes first.'
	crt.Screen.WaitForString "linux$", 2
	crt.Screen.Send "telnet 2.2.2.2" & vbCr
	crt.Screen.WaitForString "linux$", 2
	crt.Screen.Send "cisco" & vbCr
	crt.Screen.WaitForString "linux$", 2
	crt.Screen.Send "cisco" & vbCr
	crt.Screen.WaitForString "linux$", 2
	crt.Screen.Send "enable" & vbCr
	crt.Screen.WaitForString "linux$", 2
	crt.Screen.Send "cisco" & vbCr
	crt.Screen.WaitForString "linux$", 2

'name local device'
	local = InputBox("Por favor ingresar el nombre del remotizador local")
	If local = "" or local = " " or local = "\" then
		MsgBox "Nombre no valido, operacion cancelada."
		Exit Sub
	Elseif local <> "" or local <> " " or local <> "\" then
		CreateObject("WScript.Shell").Popup "Procesando "+local, 0.5, "Mensaje"
	End If

'lookup local'
'Check show'
	crt.Screen.Send show+local & vbCr
	strresult = crt.Screen.ReadString ("linux$", 2)

	If strresult = " " then
		crt.Screen.Send "conf t" & vbCr
		crt.Screen.WaitForString "linux$", 2
	Elseif strresult <> " " then
		crt.Screen.Send "telnet 3.3.3.3" & vbCr
	End if

End Sub
Reply With Quote
  #19  
Old 08-11-2017, 11:58 PM
Weidemann Weidemann is offline
Registered User
 
Join Date: Aug 2017
Posts: 1
Can you multiple if statements onone line?
Reply With Quote
  #20  
Old 08-14-2017, 07:28 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 3,098
Hi Weidemann,

I am not sure how your post is related to the current discussion but if you are asking if you can evaluate against multiple conditions in an If statement, the answer is yes:

Code:
a = 1
b = 2
If a = 1 and b = 2 Then
    MsgBox "True"
Else
    MsgBox "False"
End If
Run as shown above, you will get True. If you change to b = 3 (without changing the If statement), you would get False.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730

Last edited by bgagnon; 08-14-2017 at 07:31 AM. Reason: Clarification
Reply With Quote
Reply


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 04:07 AM.