Jump to content

Read last row in CMD Window.. Need Help


Recommended Posts

Hey Guys,

I try to read the last row from a cmd window. If the last row coincide with the preset, the cmd window should be closed.

I tried with the help file and googled also but I cant find what I need.

Sorry for my very bad english. Please help me =) My english is too bad to find the solution by myself.

Greez and Thanks alot.

Link to comment
Share on other sites

  • Moderators

@zegaris123, try something like this:

#include <Constants.au3>

$net = Run(@ComSpec & " /c ipconfig /all", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)

While 1
    $line = StdoutRead($net)
    If @error Then
        ExitLoop
    ElseIf $line <> "" Then
        ConsoleWrite("STDOUT read:" & $line & @CRLF)
    EndIf
Wend

You should be able to modify it easily to capture the line you're after

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Developers
3 minutes ago, zagaris123 said:

but I cant change it for my purpose.

Why not?  What is the problem?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Moderators
Just now, zagaris123 said:

I dont understand the code. I never worked with StdoutRead etc. And my english is bad too. If I have the right code for my problem I can watch it and learn from it.

You need to do some reading in the help file then. This is not a forum where you're spoon-fed code; it is meant to be a place where you receive help to better your scripting skills. "I don't understand it" and "I've never done this before" excuses really don't fly. If you just want someone to do it for you, head over to Rent-a-Coder.com and pay someone to do it for you.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Developers

Then you have the opportunity to learn both English and what the script does. ;)

Have you tried it with your command to see what it does?

Jos

 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • 2 weeks later...
On 9/2/2016 at 11:05 AM, JLogan3o13 said:

@zegaris123, try something like this:

#include <Constants.au3>

$net = Run(@ComSpec & " /c ipconfig /all", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)

While 1
    $line = StdoutRead($net)
    If @error Then
        ExitLoop
    ElseIf $line <> "" Then
        ConsoleWrite("STDOUT read:" & $line & @CRLF)
    EndIf
Wend

You should be able to modify it easily to capture the line you're after

This will work if you are allowing AutoIT to create your cmd1 window.

If the cmd1 window is running and AutoIT code is separate it cannot "see" the console text. So, if your cmd window is running and you try to see what is going on in the window with the AutoIT Window Info Tool, for example, you will see no text.

If you can launch whatever is creating the window with the Run command you should be able to capture the needed text and act on it.

 

I hope this helps.

Always carry a towel.

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...