Sign in to follow this  
Followers 0
Juanola

Program MS-DOS output send to window Autoit?

13 posts in this topic

#1 ·  Posted (edited)

Hi!

I want send the output of one program executed in MS-DOS to one console or memo of one Autoit Program.

For example:

Program MS-DOS Mcafee executed in DOS, the information of the files scanned what show in the window of MS-DOS and all send to in the same time to one gui of Autoit.

All the text what is writing the program in the window of MS-DOS send all at the same time in one gui of Autoit.

Don't wait.

If the window from MSDOS is showing "scanning xxxxxfile.exe..." show it text in the window of the gui, if the window of msdos show one new line with one new message of the scanning process, show it same line in the window of the gui.

Can I do it??

Thank you.

Edited by Juanola

Share this post


Link to post
Share on other sites



StdoutRead should start you in the right direction.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hi!

It is my script, but it isn't working.

It isn't showing nothing in my window of the gui.

The scan execute OK but in one window of MSDOS. If I put the parameter "@SW_HIDE"... Why the window of MSDOS of scan is show?

Why my gui isn't showing nothing line of the lines what show the process of scanning of the window of msdos?

#include <constants.au3>
#include <windowsconstants.au3>

$win=GUICreate("Scan Antivirus 2009",430,600,-1,-1)

$btn_scan=GUICtrlCreateButton("Scan",200,10,75,25)
$btn_exit=GUICtrlCreateButton("Exit",290,10,75,25)

$output_scan = GUICtrlCreateEdit("", 30, 140, 360, 400, $WS_VSCROLL)

GUISetState()

    $exit=False
    While $exit=False
        $nMsg = GUIGetMsg()
            Switch $nMsg
                case $btn_exit
                    $exit=True
                case $btn_scan
                    _write_console()
            EndSwitch
    wend
    GUIDelete()     

func _write_console()

Local $scan = Run(@ComSpec & " /c " &  'scan.exe c:\  /all /clean /del', @scriptdir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
Local $line

    While 1 
        $line=StdoutRead($scan)
        If @error Then ExitLoop
        Sleep(10)
        
        if (not ProcessExists("scan.exe")) then exitloop
        If $line <> "" then
            GUICtrlSetData($output_scan, $line & @CRLF,1)
        endif
    Wend

EndFunc
Edited by Juanola

Share this post


Link to post
Share on other sites

I suspect you are overwriting your $line.

Have a look at $line at every iteration of the loop by adding ConsoleWrite($line & @CRLF)"

That will tell you if it is a logic error or just nothing is being returned.


Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Share this post


Link to post
Share on other sites

Thank you.

I will do it.

But why the window of MS-DOS isn't hide?

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Thank you.

I will do it.

But why the window of MS-DOS isn't hide?

Edit: I'm tired =/

Edited by foster74

Share this post


Link to post
Share on other sites

Any help please?

Why if I use the same script with "ping.exe -t" it working OK!!

Local $scan = Run(@ComSpec & " /c " & 'ping.exe -t', @scriptdir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)

Where is my problem???

Share this post


Link to post
Share on other sites

What is it doing (or not doing) again?


[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Share this post


Link to post
Share on other sites

What is it doing (or not doing) again?

I'm trying write one script and you?

Share this post


Link to post
Share on other sites

Nevermind


[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Share this post


Link to post
Share on other sites

Try ShellExecute, I find that better


Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Share this post


Link to post
Share on other sites

Try ShellExecute, I find that better

But ShellExecute doesn't return any output result.

Thank you!

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
Sign in to follow this  
Followers 0