title
Products            Buy            Support Forum            Professional            About            Codec Central
 

Problem with .ReadIDTag

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Underdog

    • Dec 2007
    • 4

    Problem with .ReadIDTag

    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.
    C:\script\ListTags.vbs(11,2)
    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)
    Next


    Any suggestions what is going wrong???
  • Spoon
    Administrator
    • Apr 2002
    • 44509

    #2
    Re: Problem with .ReadIDTag

    Perhaps?:

    Dim Element As String, TheValue As String
    Spoon
    www.dbpoweramp.com

    Comment

    • Underdog

      • Dec 2007
      • 4

      #3
      Re: Problem with .ReadIDTag

      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:

      C:\script\ListTags.vbs(5,13)
      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.

      Comment

      • Spoon
        Administrator
        • Apr 2002
        • 44509

        #4
        Re: Problem with .ReadIDTag

        Are you using Vista?
        Spoon
        www.dbpoweramp.com

        Comment

        • Underdog

          • Dec 2007
          • 4

          #5
          Re: Problem with .ReadIDTag

          Windows XP SP2 - last (Windows) Updated about a week ago. Language English

          Comment

          • Spoon
            Administrator
            • Apr 2002
            • 44509

            #6
            Re: Problem with .ReadIDTag

            I think you will have to use VB.NET to do this.
            Spoon
            www.dbpoweramp.com

            Comment

            • Underdog

              • Dec 2007
              • 4

              #7
              Re: Problem with .ReadIDTag

              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...

              Comment

              • DazBYorks
                dBpoweramp Enthusiast

                • Feb 2008
                • 59

                #8
                Re: Problem with .ReadIDTag

                Hi,

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

                Code:
                For i = 0 To 10000
                Tag = dMC.ReadIDTag("z:\abc.ape", i)
                 If Tag = "" Then Exit For
                 ...
                Next
                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.

                Daz

                Comment

                • Spoon
                  Administrator
                  • Apr 2002
                  • 44509

                  #9
                  Re: Problem with .ReadIDTag

                  I will add to wish list to add to R13 (would be a while though, sorry).
                  Spoon
                  www.dbpoweramp.com

                  Comment

                  • DazBYorks
                    dBpoweramp Enthusiast

                    • Feb 2008
                    • 59

                    #10
                    Re: Problem with .ReadIDTag

                    Hi,

                    Thanks for the reply

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

                    Daz

                    Comment

                    • Spoon
                      Administrator
                      • Apr 2002
                      • 44509

                      #11
                      Re: Problem with .ReadIDTag

                      Can you post an example of the truncation?
                      Spoon
                      www.dbpoweramp.com

                      Comment

                      • DazBYorks
                        dBpoweramp Enthusiast

                        • Feb 2008
                        • 59

                        #12
                        Re: Problem with .ReadIDTag

                        Hi,

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

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

                        Daz

                        Comment

                        • Spoon
                          Administrator
                          • Apr 2002
                          • 44509

                          #13
                          Re: Problem with .ReadIDTag

                          Run dBpoweramp Configuration >> Music Converter >> Popup Info Tips >> Advanced and set Maximum Line Length to 10000
                          Spoon
                          www.dbpoweramp.com

                          Comment

                          • DazBYorks
                            dBpoweramp Enthusiast

                            • Feb 2008
                            • 59

                            #14
                            Re: Problem with .ReadIDTag

                            Hi,

                            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?

                            Daz

                            Comment

                            • Spoon
                              Administrator
                              • Apr 2002
                              • 44509

                              #15
                              Re: Problem with .ReadIDTag

                              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.
                              Spoon
                              www.dbpoweramp.com

                              Comment

                              Working...

                              ]]>