SPONSORS:






User Tag List

Results 1 to 7 of 7
  1. #1
    Junior Member
    Join Date
    Oct 2000
    Location
    Halifax, NS, Canada
    Posts
    19
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Capture text from Telnet-like program

    Hi there,

    I'm using a Telnet-like program (Terra-Term)to log into a server to check the status of certain processes. It's a secure-shell connection (ssh) which is needed for remote access to the server.

    The problem is that I need to capture the text returned in the window after a command has been sent. SilkTest can interact with the program, enter in text and send the command to the server, but I need to capture the messages that are returned.

    For example... I run the command /one/two/dhcpd status

    the server returns
    dhcpd is running...

    and I want to capture this to a string so I can run a check for the work "running".

    Any help would be appreciated.

  2. #2
    Senior Member
    Join Date
    Jul 1999
    Location
    Burlingame CA 94010
    Posts
    502
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Capture text from Telnet-like program

    Can you pipe the output to a file? If so, you can read the file into a list of string using the ListRead function.

    Hope this helps

    ------------------
    John W Green
    jwgreen@automationexpertise.com
    http://www.automationexpertise.com

  3. #3
    Junior Member
    Join Date
    Oct 2000
    Location
    Halifax, NS, Canada
    Posts
    19
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Capture text from Telnet-like program

    It would be possible to send the output of the command to a file, but that file would still be on the server. Then I'd have to use Terra-Term to read the file, which leaves me back at the start again...

    I'd need to get the text returned from running a command in the Terra-Term window into a file on the local machine.... and I have no idea how to do this..

  4. #4
    Member
    Join Date
    Sep 1999
    Location
    Boston
    Posts
    65
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Capture text from Telnet-like program

    Actually it's kinda messy but possible. I also use TT for SSH. Anyway, maybe you could just make a declarations for the main window, drag the mouse from the starting point, or do a typekeys to the point where you want it to stop highlighting text then do an ALT+C or from the edit menu select copy, then paste it to a file or where ever you want. Hope this helps...

    -Brendan

  5. #5
    Senior Member
    Join Date
    Aug 1999
    Location
    MA
    Posts
    129
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Capture text from Telnet-like program

    You could grap the contents of the TeraTerm screen into a LIST OF STRING in memory, then parse the list and look for your anticipated result.

    You could put some "smarts" into it to look x lines below a token. For example if the next line below "/one/two/dhcpd status" is where the result would be, then look at the next line and MatchStr or something to evaluate the result.
    Steven Tyler
    Manager - Performance Engineering

    Kronos Incorporated
    tel: +1 978 947 4219

  6. #6
    Junior Member
    Join Date
    Oct 2000
    Location
    UK
    Posts
    19
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Capture text from Telnet-like program

    I automated the telnet that comes with Windows 98 by using a combination of clear commands and the apps copy command. I issue a console command by calling a function that types clear<cr> then the command you wish to run. The function returns a list of string that I got by telling telnet to copy its buffer to the clipboard and then scanning the list of strings to remove the command that was typed. I had some trouble with commands that went over a line and making sure the history was large enough but I've managed to iron out most of the wrinkles. You may be able to adopt a similar method for your app.

    Andrew

  7. #7
    Junior Member
    Join Date
    Oct 2000
    Location
    Halifax, NS, Canada
    Posts
    19
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Capture text from Telnet-like program

    Thanks for the help... the clipboard method seems to be the best suited to the task (at least for now). I just had to insert a few sleep(n) statements to make sure the script wasnt running faster than Tera Term could keep up.


 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 09:26 PM.

Copyright BetaSoft Inc.