|
Answer» I don't want to reinvent the wheel
I have a batch file with the following lines:
Code: [Select]for %%a in ("*.ac3") do @echo SetMemoryMax(768) >"%%~na.avs" for %%a in ("*.ac3") do @echo LoadPlugin("bassAudio.dll") >>"%%~na.avs" for %%a in ("*.ac3") do @echo LoadPlugin("AudioLimiter.dll") >>"%%~na.avs" for %%a in ("*.ac3") do @echo BassAudioSource("%%a").normalize(0.98) >>"%%~na.avs" for %%a in ("*.avs") do wavi "%%a" - | aften.exe -v 0 -b 384 -readtoeof 1 - "Normalized-%%~na_Music.ac3" It relies on some DLL and EXE files which are in the FOLDER the batch file resides in, and on the installation of AviSynth on the system.
What I'm trying to do is create a win32 application (GUI) with Delphi. I want to use the above lines, so I'm not relying on the batch file.
My problem is the syntax used in the batch file. I can't find anything which explains what the various parts do. I know @echo displays a message in the console window, and I don't need to use that. It is the bits like for %%a in, ("*.ac3"), >>"%%~na.avs, etc. AC3 is a file extension, and avs is a avisynth script.
I'm hoping someone is wiser than me to explain it all Thanks!The FOR command is like the Swiss Army knife of batch scripting, because it can do so many things.
Have you tried typing FOR /? at the prompt? You will see a fairly comprehensive set of help screens which you can redirect to a text file.
It looks like a set of batch commands to process all the .ac3 files in a directory and create for each one an .avs file which when passed to a program or script CALLED wavi, is piped to a program called aften.exe which produces a normalised .ac3 file with a Music.ac3 suffix & extension.
for %%a in ("*.ac3") do @echo SetMemoryMax(768) >"%%~na.avs"
For each .ac3 file in the current directory, strip the .ac3 extension off the filename and use the first (name) portion to create an .avs file and put SetMemoryMax(768) as the first line of that avs file. So if it finds Cat.ac3 and Dog.ac3 it will create Cat.avs and Dog.avs, each with that first line.
*.ac3 means "all the .ac3 files". each time it finds an .ac3 file it will put its filename into the loop variable %%a. The ~n variable modifier takes a filename and removes the extension including the dot. An echo statement ending with the > redirection symbol and a filename means "create a new file and make this text the first line, destroying any prexisting file with that name"
for %%a in ("*.ac3") do @echo LoadPlugin("bassAudio.dll") >>"%%~na.avs"
Again, for each .ac3 file, in its correspondingly named .avs file (created by the previous line of code, above) append the line LoadPlugin("bassAudio.dll") to the end of it (i.e. add it below the first line created above). The >> symbol works like the > symbol described above, but means "append to an EXISTING file, or create it if it doesn't exist yet"
for %%a in ("*.ac3") do @echo LoadPlugin("AudioLimiter.dll") >>"%%~na.avs"
Likewise add the line LoadPlugin("AudioLimiter.dll")
for %%a in ("*.ac3") do @echo BassAudioSource("%%a").normalize(0.98) >>"%%~na.avs"
Likewise add the line @echo BassAudioSource("%%a").normalize(0.98)
for %%a in ("*.avs") do wavi "%%a" - | aften.exe -v 0 -b 384 -readtoeof 1 - "Normalized-%%~na_Music.ac3"
Now, having created one or more .avs files:
for each one, call a program or script called wavi thus:
wavi eachname.avs - | aften.exe -v 0 -b 384 -readtoeof 1 - "Normalized-eachname_Music.ac3"
If all goes well, you would have Cat_Music.ac3 and Dog_music.ac3
Cheers Dias!
Now I have to find the win32 equivalent for each "statement" so that I can do something similar in Delphi Curious. Is there some reason in PARTICULAR, or goal that you are trying reach, by reprogramming the batch file?Quote from: DoctorJellybean on May 28, 2008, 11:56:37 AM Cheers Dias!
Now I have to find the win32 equivalent for each "statement" so that I can do something similar in Delphi
You need a mix of Windows API calls and Delphi I guess. Quote from: llmeyer1000 on May 28, 2008, 12:15:02 PMCurious. Is there some reason in particular, or goal that you are trying reach, by reprogramming the batch file?
Yep, by doing away the need for the batch file itself and to avoid using Windows Explorer. I can built this into a GUI application which will make it easier for a beginner to UNDERSTAND. Granted, beginners prob don't know about AC3 files, etc, but it is also a learning curve for me.
Quote from: Dias de verano on May 28, 2008, 12:39:20 PM[You need a mix of Windows API calls and Delphi I guess.
I think I would. Heck, won't hurt me to experiment and learn There are a number of GUI front-ends for programs like avisynth, virtualdub, etc.
|