title
Products            Buy            Support Forum            Professional            About            Codec Central
 

Ruby scripting -- missing members

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

    • Dec 2006
    • 1

    Ruby scripting -- missing members

    I'm trying this in Ruby, which is new in two ways -- Ruby is new to me, and I can't find anybody else who's discussed connecting Ruby to dMC publicly.

    It seems to go OK for dMCScripting.Converter, but the other subobjects
    come up empty -- they are there, but I can't see or use any of the
    members. Here's code to show the problem (should be able to grok it without knowing Ruby)...

    require 'win32ole'

    cnv = WIN32OLE::new("dMCScripting.Converter")
    mp3 = WIN32OLE::new("dMCScripting.Mp3Settings")
    ogg = WIN32OLE::new("dMCScripting.OggSettings")
    wav = WIN32OLE::new("dMCScripting.WaveSettings")
    wma = WIN32OLE::new("dMCScripting.WMASettings")

    p = Hash.new
    p[ :cnv] = cnv.ole_get_methods
    p[ :mp3] = mp3.ole_get_methods
    p[ :ogg] = ogg.ole_get_methods
    p[ :wav] = wav.ole_get_methods
    p[ :wma] = wma.ole_get_methods

    p.each do |k, v|
    printf( "%s, %d members\n", k, v.size)
    v.each {|x| printf( " %s\n", x.to_s)}
    end

    printf( "dMCScripting.Converters.VolumeNormalize = %d\n", cnv.VolumeNormalize)
    printf( "dMCScripting.Mp3Settings.Frequency = %d\n", mp3.Frequency)

    ------------------

    wav, 0 members
    wma, 0 members
    cnv, 7 members
    VolumeNormalize
    PreserveTags
    DeleteSourceFiles
    ConvertToFolder
    ToFolder
    GetCompressions
    WasConvError
    mp3, 0 members
    ogg, 0 members
    dMCScripting.Converters.VolumeNormalize = 0

    dbPowerAmp2.rb:24:in `method_missing': unknown property or method
    `Frequency' (WIN32OLERuntimeError)
    HRESULT error code:0x80020006
    Unknown name. from dbPowerAmp2.rb:24

    --------------------
    Could this could be a subtle problem with the dMC dll? A Ruby bug? Lots of people are using a variety of automation hosts with the WIN32OLE library.

    I can't see what I could be doing wrong, since it works for one sub-object but not for others. Changing the order of things does not help, BTW -- dMCScripting.Conversion always works and the others come up without their members. Also, note that sticking a totally non-existent sub-object in there generates an error on the call to WIN32OLE::new. The fact that it works for the others means that WIN32OLE is indeed finding them, but they are appearing as empty.

    Thanks. --David
Working...

]]>