Jump to content
Au3Builder

StdoutRead displaying output in the scite console output instead of msgbox

Recommended Posts

Au3Builder

let me clear this up. the msgbox is empty in the above example,does not return anything I'm clueless because when I use ping autoitscript.com in place of net stop wuauserv It can read info from the stream.

 

Edited by Au3Builder

Share this post


Link to post
Share on other sites
Au3Builder

Theoretically,it should because I started script as user not admin hence I couldnt disable service nonetheless I have already replaced stdout read with stderread,with no success though.

Share this post


Link to post
Share on other sites
Floops

Did you also replace $STDOUT_CHILD  with $STDERR_CHILD ?

  • Like 1

Share this post


Link to post
Share on other sites
funkey

Why not use example in help file!!??

 

#include <AutoItConstants.au3>

Local $line
Local $Run = Run("cmd.exe" & " /c " & "net stop wuauserv", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)

While 1
    $line &= StdoutRead($Run)
    If @error Then ExitLoop
WEnd

MsgBox(0, "STDOUT read:", $line)
$Line = ""

While 1
    $line &= StderrRead($Run)
    If @error Then ExitLoop
WEnd

MsgBox(0, "STDERR read:", $line)

 

  • Like 1

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Share this post


Link to post
Share on other sites
Au3Builder
2 hours ago, Floops said:

Did you also replace $STDOUT_CHILD  with $STDERR_CHILD ?

Thanks a lot man. I forgot to change that. By the way. I have difficulty in converting non english characters from output to their proper form.

Can you or somebody else help with this matter,please?

 

 

Share this post


Link to post
Share on other sites
Au3Builder
5 hours ago, funkey said:

Why not use example in help file!!??

 

#include <AutoItConstants.au3>

Local $line
Local $Run = Run("cmd.exe" & " /c " & "net stop wuauserv", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)

While 1
    $line &= StdoutRead($Run)
    If @error Then ExitLoop
WEnd

MsgBox(0, "STDOUT read:", $line)
$Line = ""

While 1
    $line &= StderrRead($Run)
    If @error Then ExitLoop
WEnd

MsgBox(0, "STDERR read:", $line)

 

Thanks for pointing it out. I missed this example for some reason.

Share this post


Link to post
Share on other sites
Au3Builder

The topic can be closed. The proper way to get output from CMD is to use _WinAPI_OemToChar($Output). if you have trouble displaying non english characters :)

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

×