Jump to content

Keeping the console window open after execution has finished


leke
 Share

Recommended Posts

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

Link to comment
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. 

Link to comment
Share on other sites

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

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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

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 (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
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
 Share

×
×
  • Create New...