Kuroro Posted February 11, 2009 Share Posted February 11, 2009 hello everyone.. this is my first post.. i have a problem where the whole script is paused when i use the Stdoutread function.. i think the reason is that mencoder take a long time to encode one video file.. therefore, the loop will continue forever until mencoder finish its job.. so, is there any way to avoid this? #include <Constants.au3> $mencoder = Run(@ComSpec & " /c C:\mencoder.exe " & $mencoderscripthere, "C:\", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) _std($mencoder) Func _std($foo) While 1 ;it will loop here forever until mencoder finish its job $line = StdoutRead($foo) If @error Then ExitLoop MsgBox(0, "STDOUT read:", $line) Wend While 1 $line = StderrRead($foo) If @error Then ExitLoop MsgBox(0, "STDERR read:", $line) Wend EndFunc MsgBox(0, "Debug", "Exiting...") tq [quote]I change my goal post in the middle of the game[/quote] Link to comment Share on other sites More sharing options...
Manjish Posted February 11, 2009 Share Posted February 11, 2009 y don't u just try to avoid stdoutread totally.. Just use this, something like this: Run(@ComSpec & " /c C:\mencoder.exe >c:\test.txt" & $mencoderscripthere, "C:\", @SW_HIDE) This will store the command result in c:\test.txt.. Just do a filereadline and display it on a msgbox.. [font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com Link to comment Share on other sites More sharing options...
Kuroro Posted February 11, 2009 Author Share Posted February 11, 2009 my bad for not explaining the problem properly.. @Manjish, your method actually works.. but the problem is that i'm runnnig multiple line of batch file.. for example, [batch file] "C:\Documents and Settings\Ronaldo\Desktop\tools\mencoder.exe" -vf harddup -sws 2 -priority idle -of rawvideo -o a.avi "C:\Documents and Settings\Ronaldo\Desktop\tools\mencoder.exe" -vf harddup -sws 2 -priority idle -of rawvideo -o a.avi etc etc [/batch file] i use FileReadtoarray to read each line from the batch/text file and then use For-to-Next function.. so, i need to wait for the first line to finish before moving on to the second line.. that's where the problem lies.. i need to 'pause' the script so that it doesn't run the second line of the batch file before the first one finish but the first line is taking a long time before it finish and the whole script will be 'paused'.. i hope you understand it well.. [quote]I change my goal post in the middle of the game[/quote] Link to comment Share on other sites More sharing options...
Kuroro Posted February 11, 2009 Author Share Posted February 11, 2009 i have solve it.. i use shellexecute and processexist.. [quote]I change my goal post in the middle of the game[/quote] 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