MalR

where to start first project?

3 posts in this topic

Hi all, a newbie writes.....

I need to create a supposedly simple tool to support our field engineers and my IT colleagues have suggested i use AutoIt.
An original tool previously used was developed for win95/98 and over the years we've managed to kick windows into running it one way or another. Now it resolutely refuses to run on win-7 64 bit, no matter how big a stick we hit it with :) The original developer and source are now long gone.

As a first priority i need to be able to telnet into a unix based tool, generate a log file, and then download it. In the fullness of time i'll need to collect other logs, backup/restore settings, etc, but that can wait.
Having searched the forum though i'm a little confused as to where to start, and which is the best way to handle the "telnet" bit.
I've also looked at other examples in the forum for several hours, trying to understand it all (i can see telnet is a well trodden path).
I see references to TCPstartup and other seemingly related TCP*** commands.
I also see references to using the windows telnet client.
So do they required to work together, in combination? Or are they different solutions to the same problem?

I can see that there are solutions using "external" telnet tools but i need to try and keep this as "standard" as possible so that it can be rolled out to multiple users though a somewhat paranoid IT department...
From very limited testing of the telnet client so far, it seems like autoit (AU3info) can't pick up the current client messages, to allow it to then send the next necessary telnet commands. Seems like PuTTY which i can use also has the same problem.
But maybe it can, just i've not seen how yet - the tutorial didn't seem to show it.

So basically i don't really know what i'm doing. But at least i do know where i want to get to :)

While i'm not any sort of professional developer or coder, i have taught myself excel vba over the last few years to a fair level, when needs required.
Therefore, it's not the coding that i have a problem with, it's the concept of how AutoIt handles the different programs that i need to work with.

Anyone got any suggestions about where i begin or a "better" way to proceed?

Cheers,

Mal


 

Share this post


Link to post
Share on other sites



4 hours ago, MalR said:

As a first priority i need to be able to telnet into a unix based tool, generate a log file, and then download it. In the fullness of time i'll need to collect other logs, backup/restore settings, etc, but that can wait.

 

Hi @MalR
Lets split your problem step by step:
So First Question: Why Telnet?
 

Quote

I see references to TCPstartup and other seemingly related TCP*** commands.
I also see references to using the windows telnet client.
So do they required to work together, in combination? Or are they different solutions to the same problem?

The References you read about TCPStartUP and TCP* are probably about Socket Programming, is one way to do it but is going to be a hard path for you I think.
So yes are different solutions to the same problem.
 

Quote

I can see that there are solutions using "external" telnet tools but i need to try and keep this as "standard" as possible so that it can be rolled out to multiple users though a somewhat paranoid IT department...

If possible try to use SSH is Standard and more secure.
A somewhat paranoid IT department will never use telnet if possible.
 

Quote

From very limited testing of the telnet client so far, it seems like autoit (AU3info) can't pick up the current client messages, to allow it to then send the next necessary telnet commands. Seems like PuTTY which i can use also has the same problem.
But maybe it can, just i've not seen how yet - the tutorial didn't seem to show it.

The way to go is not with (AU3info) because basically you will handle DOS windows and then you need to capture STD_OUT and interact with STD_IN.

My recommendation will be to use SSH with putty and SCP or SFTP to download your logs files.
And what I would probably do is to make a Bash script that generate that log on the Unix like system and public that log with some http server so my only step will be to get that log with a simple http get or InetGet with AutoIt.

For Interacting with Dos like tools like Telnet or Putty you should read from the Help File:
 - Run() or RunWait()
- @ComSpec

This is an example how to run a DOS Command and read the entire STD_OUT Output:
 

$cPID = Run(@ComSpec & " /c " & "your command here(could be Telnet or anything)", "", @SW_HIDE, $STDOUT_CHILD + $STDERR_CHILD)
    While ProcessExists($cPID)
        $stdError = StderrRead($cPID)
        If Not @error And $stdError <> '' Then
            $info = $stdError
        EndIf
        $stdOut = StdoutRead($cPID)
        $info &= $stdOut
    WEnd

Regards
Alien.

Share this post


Link to post
Share on other sites

As alien4u suggested, I would go the SSH route when connecting to *nix.  If you do want to go with PuTTY, search the forum for PLINK.  PLINK is the command line version of PuTTY, and you can use StdinWrite and StdoutRead to interact with the process.  There a quite a few example scripts doing this.  Here is an example of connecting to a iMac though SSH, which has a *nix back end, that a wrote a few years back.  Look at the PLINK functions in the "User Logged On v.0.4.au3" script.  

 

Adam

 

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