View Full Version : Scripting Clarification

02-13-2007, 10:42 AM

Could you post some info here about scripting for your different codecs? For example, I am successfully scripting using the "mp3 (Lame)" codec, but cannot seem to get there with the "AAC (Advanced Audio Compression)" codec, and these forums are very light on scripting help...

For example, this VBS works fine:

Set dMC = CreateObject("dMCScripting.Converter")
Call dMC.Convert("C:\inputfile.flac", "C:\outputfile.mp3", "mp3 (Lame)", "-b=128", "")

...but this doesn't:

Set dMC = CreateObject("dMCScripting.Converter")
Call dMC.Convert("C:\inputfile.flac", "C:\outputfile.aac", "AAC (Advanced Audio Compression)", "-cbr 256000", "")

...neither does this:

Set dMC = CreateObject("dMCScripting.Converter")
Call dMC.Convert("C:\inputfile.flac", "C:\outputfile.wma", "Windows Media Audio 9 Release 1 (WMA Pro 9)", "", "")

I know this is probably because I am not using the CompressionCLI fields properly, which is why some info on these forums would be very much appreciated.

You know what would be ace: an example of a "Call dMC.Convert..." statement for each codec. That would sort it!


02-13-2007, 11:51 AM
Your best bet is to use cd ripper to set the settings you need then look in the reqistry for the command line, HKCU\Software\Illustrate\dbpoweramp\cdripper\profi les

02-14-2007, 04:59 AM
Thanks for the response Spoon. Having ripped with my desired settings, the reg entry "CodecCLI_AAC (Advanced Audio Compression)" says:

-cli_encoder="C:\Program Files\Illustrate\dBpowerAMP\encoder\AAC (Advanced Audio Compression)\neroAacEnc.exe" -cli_cmd="-cbr 256000 -ignorelength -hinttrack -if - -of [outfile].tmp" -selection="2,13,0"

Assuming that the input-file and output-file settings are taken care of by the quoted filenames, I've used this script:

Set dMC = CreateObject("dMCScripting.Converter")

Call dMC.Convert("C:\inputfile.flac", "C:\outputfile.aac", "AAC (Advanced Audio Compression)", "-cli_encoder C:\Program Files\Illustrate\dBpowerAMP\encoder\AAC (Advanced Audio Compression)\neroAacEnc.exe -cbr 256000 -if [infile] -of [outfile]", "C:\encodingerrors.txt")

...but it doesn't work- no output. encodingerrors.txt says "Error [outfile] not specified on command line."


02-14-2007, 05:37 AM

Set dMC = CreateObject("dMCScripting.Converter")

Call dMC.Convert("C:\inputfile.flac", "C:\outputfile.aac", "AAC (Advanced Audio Compression)", "-cli_encoder={qt}C:\Program Files\Illustrate\dBpowerAMP\encoder\AAC (Advanced Audio Compression)\neroAacEnc.exe{qt} -cli_cmd={qt}-cbr 256000 -ignorelength -hinttrack -if - -of [outfile].tmp{qt}", "C:\encodingerrors.txt")

02-14-2007, 05:42 AM
Same thing: Error [outfile] not specified on command line.

02-15-2007, 04:03 AM
My visual basic is a bit rusty try:

Call dMC.Convert("C:\inputfile.flac", "C:\outputfile.aac", "AAC (Advanced Audio Compression)", "-cli_encoder="""C:\Program Files\Illustrate\dBpowerAMP\encoder\AAC (Advanced Audio Compression)\neroAacEnc.exe""" -cli_cmd="""-cbr 256000 -ignorelength -hinttrack -if - -of [outfile].tmp"""", "C:\encodingerrors.txt")

02-15-2007, 08:15 AM
Almost! In the end, this worked:

Call dMC.Convert("C:\inputfile.flac", "C:\outputfile.aac", "AAC (Advanced Audio Compression)", "-cli_encoder=""C:\Program Files\Illustrate\dBpowerAMP\encoder\AAC (Advanced Audio Compression)\neroAacEnc.exe"" -cli_cmd=""-cbr 256000 -ignorelength -hinttrack -if - -of [outfile].tmp""", "C:\encodingerrors.txt")

I now have flac to aac scripted encoding... thanks Spoon! One thing though- it just encodes silently in the background...how would I get it to display a progress bar?

02-16-2007, 11:25 AM
Progress bars are very difficult, I do not think you could access it from Visual Basic.

02-16-2007, 11:37 AM
I guess what I want to know is: how can I do, in r12, what I used to do in r11? Our systems rely on my scripting the output of DMC to produce files encoded to various formats... it used to be so easy! I used to just replace the codec name in the script, add that I would like to see the options dialog before starting encoding, run the vbs, set the options in the dialog, and hey presto! Surely it can still be done!?

02-16-2007, 11:46 AM
There is an example on the scripting page (http://www.dbpoweramp.com/developer-scripting-dmc.htm) that gives code on how to show the compression settings dialog when your encoding via scripting.

02-16-2007, 12:07 PM
Yes, that's the scripting help file which I was saying is too vague- if the convert call is placed before the settings dialog call, the file just converts and the dialog is displayed after. If the opposite is true, the dialog is shown, then the file is converted after you press ok, but all options changed in the dialog are ignored...

I just need to know how to pass a dynamically generated list of files to convert to dmc, the equivalent of this r11 script, for example*:

Set dMC = CreateObject("dMCScripting.Converter")
dMC.VolumeNormalize = False
dMC.PreserveTags = True
dMC.DeleteSourceFiles = False
Set Mp3Settings = CreateObject("dMCScripting.Mp3Settings")
Call Mp3Settings.Set (128, 44100, 0, 0)
Call dMC.AddFromToFiles("J:\Artist\Title\01 - Track title.flac", "C:\audio\mp3\new_filename1")
Call dMC.AddFromToFiles("J:\Artist\Title\02 - Track title.flac", "C:\audio\mp3\new_filename2")
Call dMC.AddFromToFiles("J:\Artist\Title\03 - Track title.flac", "C:\audio\mp3\new_filename3")
Call dMC.AddFromToFiles("J:\Artist\Title\04 - Track title.flac", "C:\audio\mp3\new_filename4")
Call dMC.GoConversion("Mp3 (Lame)", False, True, True, False)

*I say for example because that's just one script- scripting from and to any format could be an example here...

02-16-2007, 03:11 PM
The options dialog returns a CLI string, that is passed to the compressor.

02-19-2007, 07:45 AM
Yep, that works a treat if you pass the CompressionCLI variable along:

Set dMC = CreateObject("dMCScripting.Converter")
Dim CompressionCLI
CompressionCLI = "-codec=""Windows Media Audio 9.2"" -settings=""128 kbps, 44 kHz, stereo CBR"""
CompressionCLI = dMC.ShowSettings("Windows Media Audio 9", CompressionCLI)

Call dMC.Convert("J:\Audio\01 - sourcefile.flac", "C:\Converted\01 - convertedfile.wma", "Windows Media Audio 9", CompressionCLI, "C:\encodingerrors.txt")

...BUT it just starts encoding silently in the background. I appreciate that as you said progress bars are difficult in VB, but surely when I click OK in the options window it should start the dmc 'converting...' window? And if I click 'Cancel' in the options window, shouldn't it cancel the conversion instead of going ahead anyway?

02-19-2007, 10:05 AM
CLI encoding does not use any sort of graphical interface, so no converting window.

02-19-2007, 10:20 AM
Ok thanks. I guess the answer to my question (how do I script in r12 as I did in r11, interfaces, progress bars and all) is that it's no longer possible.

Surely there must at least be a way of showing when the conversion is finished? As much as I enjoy the suspense of refreshing an explorer window to watch the filesize level out, it isn't very practical...

02-19-2007, 02:46 PM
It finishes when dMC.Convert("