Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Notices

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 05-10-2013, 11:15 AM
rdrovdahl rdrovdahl is offline
Registered User
 
Join Date: May 2013
Posts: 3
Anyway to use variables in ReadString or WaitForString?

I've set up a function that logs into Cisco devices supplied via text file and runs commands also supplied from a txt file.

I need to capture all the outputs from the commands being run to a log file and need to be very specific about the ReadString and WaitForString entries every time the function is being run.

I'm trying to use a variable in as follows.

Code:
def commands(currentdevice):
    crt.Screen.Synchronous = True
    filep = open(LOGFILE, "ab+")
    for line in open(COMMANDFILE, "r"):
		crt.Screen.Send(line + '\r')
		data = crt.Screen.ReadString(currentdevice + "#")
		filep.write(data + "\n")
		crt.Screen.WaitForString(currentdevice + "#")
    return()
So far, I've not been able to find a way to use a variable in the ReadString or WaitForString commands. Is there a way to do this or maybe some other method that would accomplish the same thing?

Thanks!

Last edited by miked; 05-10-2013 at 11:29 AM. Reason: Put code brackets around the Python code to keep the correct formatting
Reply With Quote
 

Tags
cisco , readstring , variables , waitforstring

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 02:27 AM.