View Full Version : Problem with .ReadIDTag

12-06-2007, 07:10 AM
I recently Downloaded (Few days ago) "dBpoweramp reference" for evaluation.

I want to write some scripts to clean up the tags on parts of my mp3 collection.

Every time I run the script below I get an error.
Microsoft VBScript runtime error: Type mismatch: 'dMC.ReadIDTag'

This refers to the call to:
Call dMC.ReadIDTag(TheFile, i, Element, TheValue)
Intellisense picks up the call and parameters correctly, it just wont execute.

If I comment out the previous line: Call dMC.WriteIDTag(TheFile,"Comment", "Tested Again")
this works fine and the tag is changed as expected.

' Test Script
Set dMC = CreateObject("dMCScripting.Converter")
Set WshShell = CreateObject("WScript.Shell")

Dim Element, TheValue

TheFile = "C:\Test.mp3"
' Read All IDTags
For i = 0 To 10000
' Call dMC.WriteIDTag(TheFile,"Comment", "Tested Again")
Call dMC.ReadIDTag(TheFile, i, Element, TheValue)
If Element = "" Then Exit For
Call WshShell.echo(Element,"=" , Value, 0)

Any suggestions what is going wrong???

12-06-2007, 11:01 AM

Dim Element As String, TheValue As String

12-07-2007, 04:20 AM
Ahh the wonders of Windows Scripting host...

Every thing seems to be "Variant" :(

so if I change the "DIM" statement to read:

Dim Element as String
Dim TheValue as String

I get the error:

Microsoft VBScript compilation error: Expected end of statement: Dim Element as String

I did try
Call dMC.ReadIDTag(TheFile, i, CStr(Element), CStr(TheValue))

The did not throw any errors and executed, But also seems to pass the string by value, not reference, so I get empty strings back...

B.T.W. This example came from the examples on your website. The rest of the script works fine, it's just this part.

What I eventually want to do is read in all the tags. Put then in to a CSV file, edit them in Excel and write the sanitized tags back to the corresponding files.

12-07-2007, 04:03 PM
Are you using Vista?

12-08-2007, 02:28 PM
Windows XP SP2 - last (Windows) Updated about a week ago. Language English

12-08-2007, 03:58 PM
I think you will have to use VB.NET to do this.

12-10-2007, 06:34 AM
Oh Well.....

I was just hoping for a quick solution.

Now I have to write a VB application that will end up taking the next 2 to 3 months of my spare time.... :(

It's not writing the code you understand, it's the endless tweaking and messing about with new features afterwards. ;)

Thanks for all your help, at least I won't waste any more time on a dead end scripted solution...

02-04-2008, 07:28 AM

I would like this to work using VBScript and failing a change to something like;

For i = 0 To 10000
Tag = dMC.ReadIDTag("z:\abc.ape", i)
If Tag = "" Then Exit For

Where Tag would either be an key/value array or a string I can split on the first colon, or, alternatively;

Remove the truncation of the lines when generating dMC.AudioProperties. This may be preferential as you wouldn't need to loop through (or read the file) an unknown number of times to get the tags.


02-04-2008, 08:18 AM
I will add to wish list to add to R13 (would be a while though, sorry).

02-04-2008, 08:34 PM

Thanks for the reply :)

If there is to be one, would you consider simply fixing the truncation issue in an update to R12?


02-05-2008, 04:19 AM
Can you post an example of the truncation?

02-05-2008, 08:31 AM

Metaflac, etc. says;
ACCURATERIPRESULT=AccurateRip: Accurate (confidence 5) [F7D9B17E]

AudioProperties says;
ACCURATERIPRESULT : AccurateRip: Accurat...idence 5) [F7D9B17E]


02-06-2008, 11:55 AM
Run dBpoweramp Configuration >> Music Converter >> Popup Info Tips >> Advanced and set Maximum Line Length to 10000

02-07-2008, 05:20 AM

Thanks again for the reply, but there is no difference. I assume the line length is for Editing purposes and the AudioProperties string is generated using the View code used for the limited width of the Explorer popup.

Although it may be inappropriate to mention these here, if you have Unicode strings in the tags such as curly quotes, they are displayed properly, but on editing the string would seem to be interpreted as Windows-1251? and therefore contains illegible text.
Also if you make a call to AudioProperties for a non-existent file there is output that includes the file type - should this not just generate an error or return nothing?


02-11-2008, 04:49 AM
It should have worked, if you are using Vista and the account is non-admin then the settings will not be saved in the right account (as it is elevated to admin), to fix set the account to admin.

02-11-2008, 09:47 AM

I am using XP Pro, but your post explains why it has *apparently* not worked. It seems OK with VBScript (I should have checked), but I am using PHP, which will be running as the default user, to access the info via COM objects. I have no real desire to elevate the privileges for PHP, so can I add the relevant key(s) in the registry for the default user?


02-11-2008, 03:50 PM
Copy the reg keys from software\illustrate between the branches.

02-12-2008, 04:17 AM

Thanks, we seem to have success :)

I exported the Illustrate branch, renamed the keys and imported the .reg file to the default account.


02-24-2008, 04:20 PM
I think you will have to use VB.NET to do this.

I think this Microsoft article is relevant to the original issue of Type mismatch when calling dMC.ReadIDTag: http://support.microsoft.com/kb/197956*top

When passing a parameter to a COM Component's method in Active Server Pages (ASP), the following error occurs:

Microsoft VBScript runtime error '800a000d' Type mismatch

Or the value stored in the variable passed to the method is not changed.

VBScript will pass parameters to a method by value if the argument's data type is NOT declared as a variant and the parameter is passed by reference if the argument's data type is declared as variant by the method.

Parameters to be passed by reference to a method should always be declared as a variant data type by the method, while parameters to be passed by value can be declared as any type by the method.

02-24-2008, 07:31 PM
This is what my COM object browser say the definition of ReadIDTag method is:
Sub ReadIDTag(File As String, Index As Long, pRetElement As String, pRetValue As String)

If I understand the MS article, I think the definition must be changed to:
Sub ReadIDTag(File As String, Index As Long, pRetElement As Variant, pRetValue As Variant)

02-25-2008, 05:26 AM
VBScript only have Variant data types, passing a variant would be wrong as the scripting code is expecting an OLE string.

02-25-2008, 09:20 AM
I'm just repeating what MS says on topic. Passing a variant should not prevent a well-written method to check the appropriateness and reasonableness of the data passed to it. I am not sure how to interpret your answer. Does this mean that dMC is not compatible with VBScript? If so, that might be important for some customers to know before purchasing.

02-25-2008, 10:10 AM
That one function is not, we will be writing a new method for R13.

02-25-2008, 10:19 AM
Thanks for the quick response. I look forward to R13. In the meantime, I have gotten tons of value and had fun using R12.4. It has helped me clean-up a number of issues with my music library already.

10-06-2010, 06:13 PM
Has anything changed in R14? I have Windows 7 x64 running on Intel Core i7 (shows as 8 cores). But ReadIDTag does not return any value on 64 bit platform, although it works well on a 32 bit windows 7 platform.

I compiled the code inseveral different ways on Windows 7 box:
1. CPUAny, on 64 bit Windows 7 - does not work
2. CPUx86, on 64 bit Windows 7 - exception on dMC creation, of course
3. CPUAny, on Windows 7 32 bit - works

What gives?

Here is the sample code:

DMCSCRIPTINGLib.Converter dMC = new DMCSCRIPTINGLib.ConverterClass();

for (int i = 0; ; i++)
string Element = "", TagVal = "";
dMC.ReadIDTag(srcFile, i, ref Element, ref TagVal);
if (Element.Length == 0)
Console.WriteLine("\tReading Tag[{0}] '{1}:{2}'", i, Element, TagVal);
dMC.WriteIDTag(destFile, Element, TagVal);

10-07-2010, 06:58 AM
I can see why it is not working in x64, will address for R14.1

08-30-2014, 07:03 PM
That one function is not, we will be writing a new method for R13.

What is the new method to replace ReadIDTag, please? In R15 the only other I see is ReadIDTagElementValue, which returns a combined string.

08-31-2014, 04:58 AM
It was .ReadIDTagElementValue

These functions have always returned multi artists combined.

08-31-2014, 07:55 AM
It was .ReadIDTagElementValue

OK, thanks.

These functions have always returned multi artists combined.

I was referring to the combination of Element and Value. Which is OK... until the separator crops up inside Element :)