arnett Posted December 2, 2011 Share Posted December 2, 2011 This code prints the output right (the second MessageBox): Run("python GetText.py", "", "", $STDOUT_CHILD) $line = StdoutRead($PID) MsgBox(0, "", "") $line2 = StdoutRead($PID) MsgBox(0, "Debug223132", $line2) But this doesnt: Run("python GetText.py", "", "", $STDOUT_CHILD) ;$line = StdoutRead($PID) MsgBox(0, "", "") $line2 = StdoutRead($PID) MsgBox(0, "Debug223132", $line2) Can anyone please tell me why? Arnett. Link to comment Share on other sites More sharing options...
KaFu Posted December 2, 2011 Share Posted December 2, 2011 (edited) I bet the first one does not work too, because you're missing to define $PID. If you had done this, the first one would work because the first msgbox adds a delay to the execution and the result is available on the second call. Without the msgbox there seems to be not enough time that the stdout buffer has been filled by the executable. Stick to the examples in the help-file and do a loop. "StdoutRead sets @error to non-zero if EOF is reached", means the process has finished flushing data to stdout. #include <CONSTANTS.AU3> $iPID = Run("python GetText.py", "", "", $STDOUT_CHILD) Local $line, $timer = TimerInit() While 1 $line = StdoutRead($iPID) If @error Then ExitLoop if TimerDiff($timer) > 5000 Then ExitLoop ; timeout Wend MsgBox(0, "STDOUT read:", $line) Edited December 2, 2011 by KaFu OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
arnett Posted December 3, 2011 Author Share Posted December 3, 2011 The first one is working, the code is big, so I put only part of it here... Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now