Jump to content
Sign in to follow this  
Guest rjr789

Basic Function Help

Recommended Posts

Guest rjr789


I have been using v2.64 for a while to automate router configs. I have just starting using v3 and I have a few questions.

Here is a v3 script to sh run on my routers:

For $router = 1 to 12

If $router = 8 Then ContinueLoop

Run(@ComSpec & " /c cmd")

Sleep (1000)

Send ('telnet 10.10.' & $router & '.1{ENTER}')

Sleep (3000)

Send ( 'pass{ENTER}' )

Sleep ( 1000 )

Send ( 'sh ver{ENTER}' )

Sleep ( 3000 )


The above code works fine for one command. I have also used it for other commands besides the running config. I would like to run another command sometimes depending on the outcome of the first for loop.

1. Should I create a function which would contain the code between the Run and last Sleep command above and then create another function that would do a dependent command on the outcome once the for loop has ended?

2. For example --> Func router ( ) - I have seen examples in the forum where the space between the parentheses are blank for user functions and then sometimes they have a value or variable enclosed. What is the significance of the parentheses value (if any)?

I know these are basic programming questions.

Thanks for the help!


Edited by rjr789

Share this post

Link to post
Share on other sites

I'm pretty sure autoit can't read cmd boxes (correct me if i'm wrong developers).

On other note, your script would be better with runwait.

Offering any help to anyone (to my capabilities of course)Want to say thanks? Click here! [quote name='Albert Einstein']Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.[/quote][quote name='Wolvereness' date='7:35PM Central, Jan 11, 2005']I'm NEVER wrong, I call it something else[/quote]

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...