Network Automation Software We are currently migrating this forum
over to our HelpSystems domain. Please
post all new threads in our new
HelpSystems Community Portal.
Post to the HelpSystems Forum
You are not currently logged on. You must be logged on in order to post. Log on
Or Create a new account
AutoMate Discussion
Decrease font size
Increase font size
Topic Title: Get text from a command prompt screen?
Topic Summary:
Created On: 08/06/2018 07:32 AM
Status: Read Only
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
View similar topics View similar topics
View topic in raw text format. Print this topic.
 08/06/2018 07:32 AM
User is offline View Users Profile Print this message

Author Icon
JacobNielsen
Journeyman (50-99)

Posts: 84
Joined: 10/02/2015

Sorry; originally posted this in the wrong place.

I've looked high and low, but I can't seem to find any information on how to get the text from a command prompt screen.

The reason for needing this is: we're sending a telnet command to a host/port. If the screen is blank, then it's all good. If it comes back with the "Could not open..." message, then we need to take other steps.

Could someone please point me in the right direction?

 Category Survey
 08/07/2018 04:31 AM
User is offline View Users Profile Print this message

Author Icon
DavidSeibel
Apprentice (20-49)

Posts: 42
Joined: 11/14/2014

It appears that running the telnet command via the "Run" action doesn't return any text on the error/output streams.

But, try using the "Terminal - Connect" action, it seems to work the same as Telnet at detecting listening ports, in the little bit I've used it. It will return with error code 16241: "No connection could be made because the target machine actively refused it." if the port isn't open.

 Category Survey
 08/07/2018 06:47 AM
User is offline View Users Profile Print this message

Author Icon
JacobNielsen
Journeyman (50-99)

Posts: 84
Joined: 10/02/2015

That is an option, yes; however, it doesn't quite answer my question: is there a way in Automate to retrieve text from a command prompt screen? We're also wanting this for other actions and tasks. The telnet task is the most current example where we would like to be able to get the text, if possible, so I used that one.

 Category Survey
 08/07/2018 07:38 AM
User is offline View Users Profile Print this message

Author Icon
Leonard Amabile
HelpSystems

Posts: 5454
Joined: 05/15/2007

Jacob,

Please post a sampling of your task. The Run action is able to capture output from a command prompt screen. If you are looking to grab the text outside of the Run action, then you can use the OCR action against a screenshot of the command prompt window to grab the text.

 Category Survey


-------------------------

Leonard Amabile | Director, Cross Platform Support
AutoMate | InterMapper | Skybot | Divisions of HelpSystems
T: +1.213.738.1700 | F: +1.213.738.7665
 08/07/2018 09:02 AM
User is offline View Users Profile Print this message

Author Icon
JacobNielsen
Journeyman (50-99)

Posts: 84
Joined: 10/02/2015

Leonard:

Run cmd.exe
Send keystrokes "telnet [server] [port]"

That's the code. If it's successful, a blank screen comes up. If not, it's a command prompt screen with an error message.

How would you use Run to capture the output?

 Category Survey
 08/07/2018 09:43 AM
User is offline View Users Profile Print this message

Author Icon
Leonard Amabile
HelpSystems

Posts: 5454
Joined: 05/15/2007

Sample code below:

 Category Survey



Task Steps: (Right click, Select All, Copy to copy to the clipboard. Steps can then be pasted into the AutoMate Task Builder)


-------------------------

Leonard Amabile | Director, Cross Platform Support
AutoMate | InterMapper | Skybot | Divisions of HelpSystems
T: +1.213.738.1700 | F: +1.213.738.7665
 08/07/2018 10:36 AM
User is offline View Users Profile Print this message

Author Icon
JacobNielsen
Journeyman (50-99)

Posts: 84
Joined: 10/02/2015

Thank you for the example.

I tried it out and it seems to be succeeding, no matter what machine or port we run it against. Not sure what's happening with it, so we'll probably just stick with what we have in place right now.

Thank you for your input and help with this.

 Category Survey
 08/07/2018 11:54 AM
User is offline View Users Profile Print this message

Author Icon
Leonard Amabile
HelpSystems

Posts: 5454
Joined: 05/15/2007

Hi Jacob,

The Run step will succeed because telnet is succeeding but generating an error, if that makes sense. The sample populates variables with what telnet is reporting back to the screen. Is that where you are not seeing the correct message? If so, try prefixing your command line with cmd.exe /c and see if that helps.

 Category Survey


-------------------------

Leonard Amabile | Director, Cross Platform Support
AutoMate | InterMapper | Skybot | Divisions of HelpSystems
T: +1.213.738.1700 | F: +1.213.738.7665
Statistics
18258 users are registered to the AutoMate Discussion forum.
There are currently 0 users logged in.
The most users ever online was 5551 on 01/08/2018 at 11:11 AM.
There are currently 220 guests browsing this forum, which makes a total of 220 users using this forum.

FuseTalk Enterprise Edition v4.0 - © 1999-2019 FuseTalk Inc. All rights reserved.

Sitemap Network Automation Software Blog