leke

Keeping the console window open after execution has finished

5 posts in this topic

I have an app that rips .ts files, but I'm having a problem seeing the the error message ffmpeg is displaying because the console window closes right after the message is rendered. 

If I manually type the equivalent command from the command line, the .ts file rips ok, so I'm guessing it's not the command itself that is the issue. 

How do I get the console window to remain open when running it through my autoIt app? 

Code in question...

Func RipIt($WhereIsFfmpeg, $TsPath)
    ; Creates rip in same folder as original.
    $ffmpeg_command = $WhereIsFfmpeg & " -i " & $TsPath & " -b:v 1200k -vcodec libx264 " & $TsPath & ".mp4" ; The ffmpeg rip settings.
    Run($ffmpeg_command, "", @SW_MAXIMIZE) ; the ffmpeg command.
EndFunc

 Thanks :)

Source code.exe

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Check on the help for StderrRead / StdoutRead so you can get the output from ffmpeg command line

P.S. In $ffmpeg_command don't forget the quotes " " if there are space in the path/variable like:

'"' & $TsPath & '"'

 

Edited by MyEarth
1 person likes this

Share this post


Link to post
Share on other sites

Check on the help for StderrRead / StdoutRead so you can get the output from ffmpeg command line

P.S. In $ffmpeg_command don't forget the quotes " " if there are space in the path/variable like:

'"' & $TsPath & '"'

 

Thanks, I tried the adding quotes first and it ended up being the problem. I did read about the StderrRead / StdoutRead args in the docs, but couldn't figure out what they were supposed to do. I guess I should just add them in to the Run function with the old code and see what happens. 

Share this post


Link to post
Share on other sites

Use RunWait. This waits until the called program has finished processing.

1 person likes this

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-02-03 - Version 1.4.7.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

For Ffmpeg I tend to use the following

Run(@ComSpec & " /c " & 'ffmpeg.exe ' & $parameters, $ffmpegdir, @SW_SHOW)

And while troubleshooting, I use /k instead of /c which then keeps your console window open.

 

Edited by TheSaint
1 person likes this

AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox

userbar.png

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

  • Similar Content

    • PClough
      By PClough
      Hi everyone!
      I want to programmatically alter the structure of a large number of PDF which have different sizes and orientation, and come from different generators. To do this I need to be able to capture different parameters describing their layout.  I use a console tool called pdfInfo (part of the xpdf public domain suite) which provides me with everything I need. The idea is first to run pdfInfo against my pdf file redirecting the console's output to a text file. And then to load and parse the text file to get the parameters I need.  The only problem is that no output file is ever created.  I've looked through the forums and saw a number of threads loosely related to this but none of the suggested solutions (like using StdoutRead) has worked for me. I should say maybe that I'm running Win10.
      So here's the code that doesn't work:
      $pdfInfo = "f:\pdfinfo.exe" $pdfTest = "f:\test.pdf" RunWait(chr(34) & $pdfInfo & " -box " & $pdfTest & " > f:\log.txt", "", @SW_HIDE) If you use in a console the command line: 
      f:\pdfinfo.exe -box f:\test.pdf > f:\log.txt
      it works perfectly.  But the piece of code above does not create the log.txt file. So any idea what I am doing wrong.  Thanks for any help!
       
       
    • aiter
      By aiter
      I am running my compiled application as a console application and need to prevent any internal errors from being displayed as a gui message, but rather display it as a console message only. An example of such an error would be a bad array reference (out of bounds).
      Does anyone know how to do this or point me in the right direction?
    • TXTechie
      By TXTechie
      I normally launch things silently, but now I want to launch a batch (.cmd) file and have it run as normal displaying it's standard output to the user. Whether I use ShellExecuteWait or RunWait, the command prompt window is displayed, but the output is blank (although I know that the batch file is processing normally because it also produces a log file).
      If this is because AutoIt is re-directing the standard I/O of the batch file/console window, is there a way I can bypass the I/O redirection?
      Thanks,
      TXTechie
    • Simpel
      By Simpel
      Hi,
      I updated to the last version. Since then a lot of functions are not working.  For instance expanding abbreviation. My au3abbrev.properties are correct and abbrev.properties are including both import lines. The abbreviation is red but won't expand. Neither with space nor Ctrl+B.
      Debug to msgbox and console not working, list functions, jump to function, open include too.
      SciTE Jump works. Block and box comment too.
      I have the feeling all functions especially for autoit are not working.
      Any help? Regards, Conrad
    • MyUM
      By MyUM
      Hello, I have a console application that works with command line arguments which I don't have its source code, & I want to create a GUI for it to make it easier.
      My problem is how to make the GUI application calls the console application & handle its output results to display it in the GUI application  with a progressbar or somthing ?
      Please look at the "X265 Command Line Options"
      https://x265.readthedocs.org/en/default/cli.html
      MeGUI is only a GUI app for the cli apps :
      http://sourceforge.net/p/meguimodproj/code/HEAD/tree/MeGUI Mod/
      Help me please