Sign in to follow this  
Followers 0
emule

Need a few simple telnet commands executed

3 posts in this topic

I'm looking to automate a few telnet commands via a GUI. It needs to have the ability to input the IP address then launch the telnet session executing commands based on what has been specified in the GUI. I'm a complete newbie at anything related to programing. I'm a wireless internet engineer : ( This is needed to enable/disable the ethernet port on a device.

post-44015-1236369426_thumb.jpg

The Telnet code looks like this:

telnet 192.168.40.101

Login: admin

Password: *from gui*

set DataTraffic *from gui* Note: (1 = enabled & 0 = disabled)

logout

y

exit

Any help is greatly appreciated.

Share this post


Link to post
Share on other sites

#2 ·  Posted (edited)

Look at _RunDos() in the helpfile.

Edit: and GUICtrlRead().

Edited by Prab

Share this post


Link to post
Share on other sites

Here's what I have so far...it works up to the point where it needs to include the IP address but nothing shows up. Obviously, this code was taken from the help, but I may have butchered it.

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $IP, $n2, $msg
    
    GUICreate("My GUICtrlRead")
    
    $IP = GUICtrlCreateInput("", 10, 10, -1, 20)
    
    $n2 = GUICtrlCreateButton("OK", 10, 30, 50)
    GUICtrlSetState(-1, $GUI_FOCUS)
    
    GUISetState()
    
    Do
        $msg = GUIGetMsg()
        If $msg = $n2 Then

        Run("cmd.exe")
        WinWaitActive("C:\WINDOWS\system32\cmd.exe")
        Send("telnet ", GUICtrlRead($IP))

        EndIf
    Until $msg = $GUI_EVENT_CLOSE
EndFunc

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  
Followers 0