Jump to content

Recommended Posts

Posted

I'm using SciTE to write and test this script.

$iResult = RunWait(@ComSpec & ' /c "' & 'runtest.exe -i "'&$sVideo&'"', "c:\Test\Sample_Test\", @SW_SHOW, $STDERR_CHILD)
ProcessWaitClose($iResult)
Local $sOutput = StderrRead($iResult)
MsgBox(0, "Output", $sOutput)
UpdateLogFile("Output is ",&$sOutput)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

;This works fine on my test system:
#include <AutoItConstants.au3>

$CMD = 'echo ipconfig /all && ipconfig /all'
Local $iPID = Run(@ComSpec & ' /c "' & $CMD & '"', @SystemDir, @SW_HIDE, $STDOUT_CHILD)
ProcessWaitClose($iPID)
Local $sOutput = StdoutRead($iPID)
MsgBox(0, "Output", $sOutput)

I get nothing in the MsgBox, but I get the text I'm looking for in the bottom panel that shows the script running. How do I get that text into the MsgBox? If I can see i there, I can write it to a file, which is the end purpose. I've tried @SW_HIDE with the above & $STDOUT_CHILD with StdOutRead($iResult), but that does not print to the bottom panel, so Stderr_child must be it.

The bottom test works fine, providing a $sOutput I can use.

I am obviously doing something wrong, or the console output from runtest.exe (pseudonym for the actual app which I did not write and cannot control) is just weird.

Thanks in advance for any help!

Jibsman

  • Developers
Posted
  On 8/19/2016 at 7:53 PM, JibsMan said:

I've tried @SW_HIDE with the above & $STDOUT_CHILD with StdOutRead($iResult), but that does not print to the bottom panel, so Stderr_child must be it.

Expand  

I am a little lost with this statement. Care to elaborate or even better post something we can play with that isn';t working for you.

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

Posted

@JibsMan did you check HelpFile Example ?
You should use While Wend   Loop.

Local $sOutput = ""
    While 1
        $sOutput &= StdoutRead($iPID)
        If @error Then ; Exit the loop if the process closes or StdoutRead returns an error.
            ExitLoop
        EndIf
    WEnd
    MsgBox($MB_SYSTEMMODAL, "Stdout Read:", $sOutput)

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

Hi Jos,

I figured out what I was doing wrong (with the help of another programmer).

I did not understand what @SW_SHOW and @SW_HIDE actually did. If I understand now, @SW_SHOW displays the console output in the bottom panel of SciTE, and @SW_HIDE hides it. If this is still incorrect, and if there are docs explaining it, can you give me a link or hint how to find it?

I changed RunWait to Run, assuming the ProcessWaitClose(iPID) would do the same thing. Using the $STDOUT_CHILD in Run and StdoutRead(iPID) worked. I think RunWait was causing issues.

The code below works for me!

$iResult = RunWait(@ComSpec & ' /c "' & 'runtest.exe -i "'&$sVideo&'"', "c:\Test\Sample_Test\", @SW_SHOW, $STDOUT_CHILD)
ProcessWaitClose($iResult)
Local $sOutput = StdoutRead($iResult)
MsgBox(0, "Output", $sOutput)

Thanks for your help!

Jibsman

SciTE.jpg

  • Developers
Posted (edited)
  On 8/19/2016 at 8:55 PM, JibsMan said:

The code below works for me!

Expand  

Don't think so ...  that has a RunWait in it which doesn;t return the process handle. :)

@SW_HIDE will set the Window property, and tell it not to show on the desktop and is totally unrelated to the STDOUT & STDERR output.
The text you see in the SciTE Outputpane is the AutoIt3Wrapper information and the output that came back from the Run() statement, both STDOUT and STDERR.

Jos 

 

Edited by 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.
  :)

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...