Jump to content

Autoit And Teraterm Pro?


Guest Rombus
 Share

Recommended Posts

Guest Rombus

Ok, im writing a script that logs into a switch to see if a users connected, is there anyway i can grab a certant line and read it into a variable if i know what the line with start with using autoit? Thanks!

Link to comment
Share on other sites

if you can get the text, yes.

Say you copy this to clipboard:

From: EarthLink High Speed Internet Team <dslsales@earthlink.net>

Subject: EarthLink High Speed Internet -- 6 Months for $29.95 per Month!**

Date: Fri, 19 Mar 2004 05:48:57 PDT

X-Accept-Language: en

MIME-Version: 1.0

Content-Type: multipart/alternative;

types="text/plain,text/html";

From: EarthLink High Speed Internet Team <dslsales@earthlink.net>

Subject: All the spam you can handle -- 6 Months for $19.95 per Month!**

Date: Fri, 19 Mar 2004 05:48:57 PDT

X-Accept-Language: en

MIME-Version: 1.0

Content-Type: multipart/alternative;

types="text/plain,text/html";

then you could use this to get each subject line:

$everything=clipget()
while 1
if StringInstr($everything,"Subject: ")=0 then ExitLoop
$len=StringInstr($everything,"Subject: ")+9
$line=StringMid($everything,$len,StringInStr($everything,"Date: ")-$len-1)
MsgBox(1,"subject",$line)
$everything=StringTrimLeft($everything,StringInstr($everything,"Date: "))
wend

You can do similar things to get from a file, and I used the "Date: " to seperate, but you could use the end of line or whatever your fancy.

AutoIt3, the MACGYVER Pocket Knife for computers.

Link to comment
Share on other sites

Guest Rombus

Yes but can i do it automatically? as part of the script? im trying to do this so i dont have to teach our whole staff how to use the telnet side of our switches :whistle: my goal is for the only user interaction to be inputing the switch IP and the port there curious about and having the script do the rest

Link to comment
Share on other sites

Maybe, but I am ignorant on Teraterm Pro.

Can you use a commandline to output that into a text file?

AutoIt doesn't read Dos windows too well, so normally you output the info to a text file, read it, and delete the temporary text file. ex:

RunWait("cmd /c net view >computers.txt","",@SW_HIDE)

once in a text file, automation is easy.

AutoIt3, the MACGYVER Pocket Knife for computers.

Link to comment
Share on other sites

How do you access your switch? If you do it via a command line window then you can use the following line to get the window test into the Clipboard

send("!{space}es{enter}")

You may want to set the command window buffer to something greater than 25 if there is a lot of text in reply

GrahamS

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...