Help - Search - Members - Calendar
Full Version: How to run a batch file from EAC?
Hydrogenaudio Forums > Lossless Audio Compression > Lossless / Other Codecs
JJZolx
I've done a few searches and I see that some people in this forum are running batch files (.bat or .cmd) as the external encoder from EAC. I haven't been able to find exactly how this is being done, however. I want to do the same thing but I _always_ get an error thrown by EAC when I check "Check for external programs return code".

To troubleshoot I've reduced the test case to as simple a batch file that I can create and I'm calling it with no additional command line parameters.

Under "Program, including path, used for compression"

C:\WINDOWS\system32\cmd.exe

And under "Additional command line options:"

/c C:\test.bat

test.bat is the followng, which writes a simple string to an output file, just so I know whether it successfully ran:

echo Hello >C:\test.txt

Windows XP Pro is the operating system. What's the trick?
Synthetic Soul
The setup you describe works fine for me - although I use WINNT instead of WINDOWS as I use Win2K.

It may be worth having a look at this screenshot (if you haven't already) but I don't think anything else on that dialogue should affect the result.

The only two things I can think of which would cause a problem are:
  1. Are you sure C:\test.bat exists? I get "The external compressor returned an error" if I point to a non-existent batch file
  2. Could this be a write permissions issue? Does the user account have permission to write to the C:\ drive?
The only other advice I can give is this: use PAUSE a lot when debugging batch files. Use PAUSE to stop the window closing so you can see if any response has been returned to the console. If your batch file is terminating prematurely put PAUSEs between lines to find out which line causes the termination.

You don't actually say whether the console is popping up or not. If not then there may be a problem with the path you've provided. If it does then it's an error in your code*, and you should use PAUSE to halt execution - I would even do:

PAUSE
ECHO Hello > C:\test.txt
PAUSE


* As the code you're using in this example is obviously valid then I can only assume the error would occur due to the script trying to write to the C: drive (permissions error)

Does the console window popup briefly once the WAV file has been created?


Edit: The only other thing I can think of: Press F9 in EAC to open the EAC Options. Go to the Tools tab. Ensure "Do not open external compressor window" is not checked.
JJZolx
QUOTE
Edit: The only other thing I can think of: Press F9 in EAC to open the EAC Options.  Go to the Tools tab.  Ensure "Do not open external compressor window" is not checked.

I did indeed have this checked, as it's an annoyance when simultaneously ripping and doing anything else on the computer.

Were you suggesting this to aid in debugging the problem, or were you suggesting it to _fix_ the problem?

I ask because as soon as I uncheck it (and I get the annoying window flash open) it works. If the "do not open" is checked then the batch file does not execute and I get the error message about the external program returning an error.
Synthetic Soul
QUOTE(JJZolx @ Dec 1 2004, 08:19 AM)
Were you suggesting this to aid in debugging the problem, or were you suggesting it to _fix_ the problem?

I ask because as soon as I uncheck it (and I get the annoying window flash open) it works.  If the "do not open" is checked then the batch file does not execute and I get the error message about the external program returning an error.
*
Then it was definately a suggestion to fix the problem smile.gif

Dunno - there was so little to go wrong with your batch file I just suggested anything I thought could possibly, remotely, be relevant.

At least it's working now. I really don't have a problem with the shells opening - I'm pretty sure they open in the background anyway. I think it's a small price to pay for a truely flexible automated process.

Out of interest, what are your goals?
JJZolx
QUOTE
Out of interest, what are your goals?

I'm not 100% certain yet. At a minimum I'll be encoding to both flac and mp3 formats, creating directories by artist and album as needed. I understand I may be able to do this with MAREO but I haven't looked into its capabilities and I suspect I'll have more flexibility by writing my own scripts. I've worked with NT batch files before as well as Windows Scripting Host and a little Python, so I've got a few good tools at my disposal.
Synthetic Soul
If you are already proficient then I doubt it will be any help - I'm no expert - but it may be worth taking a look at my files which can be found here:

http://synthetic-soul.mysite.wanadoo-membe.../cd_backup.html

You will most definately have more flexibilty using bacth files over MAREO - but it does sound like MAREO would do what you want (so far). It's a lot less effort smile.gif

I was tempted to rewrite my batch files using WSH - but one benefit of the batch files (probably the only) is the easy integration with command line utils - i.e.: all output being wrriten to the same window. I did have a quick play with WSH's Exec method and capturing stdout - but didn't have that much luck.

Edit 2005-01-13: Updated URL to blueyonder address[/url]
JJZolx
You know what? I was playing around with MAREO this evening and I get exactly the same behavior - If I check off "Do not open external compressor window" in EAC MAREO actually crashes (throws a Windows error).
Synthetic Soul
QUOTE(JJZolx @ Dec 6 2004, 06:57 AM)
You know what?  I was playing around with MAREO this evening and I get exactly the same behavior - If I check off "Do not open external compressor window" in EAC MAREO actually crashes (throws a Windows error).
*
Maybe it's when the batch file or MAREO tries to write to the screen.

If you are interested, you could try running a batch file that does no ECHOing with "Do not open external compressor window" checked, and see if it works...

Dunno, as I say, I have no issue with the shell popping open - I'm quite sure that it opens in the background, and I like to be able to check what's going on.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.