Menu

AudioGenie in PowerShell

Help
Brent
2011-06-13
2013-04-25
  • Brent

    Brent - 2011-06-13

    I wish to write a PowerShell script using AudioGenie but I am not able to get it to run library commands.

    I have to Add-Type tried both the C# and .NET wrappers, which appears successful, but can not run any commands from the library.

    I have copied the .dll to the working folder, the SysWOW64 folder, and the system32 folder.

    My output is below.

    C#

    PS C:\AudioGenie> Add-Type -path ".\AudioGenie2.cs"
    PS C:\AudioGenie> AudioGenie2.AUDIOAnalyzeFile("test.mp3")
    The term 'AudioGenie2.AUDIOAnalyzeFile' is not recognized as the name of a cmdlet, function, script file, or operable p
    rogram. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
    At line:1 char:29
    + AudioGenie2.AUDIOAnalyzeFile <<<< ("test.mp3")
        + CategoryInfo          : ObjectNotFound: (AudioGenie2.AUDIOAnalyzeFile:String) [], CommandNotFoundException
        + FullyQualifiedErrorId : CommandNotFoundException
    

    .NET

    PS C:\AudioGenie> Add-Type -path ".\audiogenie3.vb"
    PS C:\AudioGenie> AudioGenie.AUDIOAnalyzeFile("test.mp3")
    The term 'AudioGenie.AUDIOAnalyzeFile' is not recognized as the name of a cmdlet, function, script file, or operable pr
    ogram. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
    At line:1 char:29
    +  AudioGenie.AUDIOAnalyzeFile <<<< ("test.mp3")
        + CategoryInfo          : ObjectNotFound: (AudioGenie.AUDIOAnalyzeFile:String) [], CommandNotFoundException
        + FullyQualifiedErrorId : CommandNotFoundException
    

    How do I get AudioGenie to work with PowerShell?

     
  • Brent

    Brent - 2011-06-19

    Ok I have got a little further, but still struggling here. Any help would be appreciated.

    The C# wrapper has been loaded as above, & I can run some AudioGenie commands without error, but it is not behaving as I would expect, and not accepting any input files. See the snippet below.

    PS F:\AudioGenie> [AudioGenie.AudioGenie2]::AUDIOAnalyzeFileW ("F:\flac2mp3\mp3\01 - Seaside.mp3")
    Unexpected token '(' in expression or statement.
    At line:1 char:46
    + [AudioGenie.AudioGenie2]::AUDIOAnalyzeFileW ( <<<< "F:\flac2mp3\mp3\01 - Seaside.mp3")
        + CategoryInfo          : ParserError: ((:String) [], ParentContainsErrorRecordException
        + FullyQualifiedErrorId : UnexpectedToken
    PS F:\AudioGenie> [AudioGenie.AudioGenie2]::AUDIOAnalyzeFileW("F:\flac2mp3\mp3\01 - Seaside.mp3")
    Method invocation failed because [AudioGenie.AudioGenie2] doesn't contain a method named 'AUDIOAnalyzeFileW'.
    At line:1 char:44
    + [AudioGenie.AudioGenie2]::AUDIOAnalyzeFileW <<<< ("F:\flac2mp3\mp3\01 - Seaside.mp3")
        + CategoryInfo          : InvalidOperation: (AUDIOAnalyzeFileW:String) [], RuntimeException
        + FullyQualifiedErrorId : MethodNotFound
    PS F:\AudioGenie> [AudioGenie.AudioGenie2]::GetAudioGenieVersionW
    PS F:\AudioGenie>
    PS F:\AudioGenie>
    
     
  • Brent

    Brent - 2011-07-04

    Ok, great, thanks for the lesson.

    I've got it cracked now!

    PS > $sourceCode = @"
    Include the contents of the c# wrapper in a Here-String
    "@
    PS > Add-Type -TypeDefinition $sourceCode
    PS > [AudioGenie.AudioGenie2]::AUDIOAnalyzeFile('F:\music.flac')
    FLAC
    PS > [AudioGenie.AudioGenie2]::AUDIOTrack
    01
    PS > [AudioGenie.AudioGenie2]::AUDIOGetMD5Value()
    0c42188b55c5df885674fd4b53359732
    
     

Log in to post a comment.