Note that there are some explanatory texts on larger screens.

plurals
  1. PORuby and WIN32OLE: Cannot call WIN32OLE_TYPE methods (Type Libraries)
    primarykey
    data
    text
    <p>Okay, so I'm doing some good OLE' (sorry) automation with ruby and I ran into a weird problem. I'm trying to extract some data from a Type Library. This works in VB:</p> <pre><code>Dim c As New TControlsLib.LangCombo Dim l As TControlsLib.Language Dim converter As New TControlsLib.LcidConverter c.AddAllSystemLanguages mtAllKnownLanguages, True For Each l In c.Languages Debug.Print l.DisplayName &amp; ";" &amp; converter.IsoAbbreviationFromLcid(l.Lcid) Next </code></pre> <p>TControlsLib is the Type Library (Full name: "TRADOS Controls Type Library"). I also know that mtAllKnownLanguages is a constant that equals 3.</p> <p>So, I tried to do the same in Ruby. Here's my IRB session:</p> <pre><code>irb(main):001:0&gt; require 'win32ole' =&gt; true irb(main):002:0&gt; t = "TRADOS Controls Type Library" =&gt; "TRADOS Controls Type Library" irb(main):003:0&gt; c = WIN32OLE_TYPE.new(t, "LangCombo") =&gt; LangCombo irb(main):004:0&gt; converter = WIN32OLE_TYPE.new(t, "LcidConverter") =&gt; LcidConverter irb(main):005:0&gt; c.ole_methods =&gt; [QueryInterface, AddRef, Release, GetTypeInfoCount, GetTypeInfo, GetIDsOfNames, Invoke, Enabled, Enabled, Languages, Refresh, AddSystemLanguage, SelectedItem, SelectedItem, SelectLanguage, Clear, AddAllSystemLanguages, DroppedDownHeight, DroppedDownHeight, AddCustomLanguage, AddLanguage, Type, Type, RemoveLanguage, OnSelectionChanged] irb(main):006:0&gt; c.AddAllSystemLanguages(3, true) NoMethodError: undefined method `AddAllSystemLanguages' for LangCombo:WIN32OLE_TYPE from (irb):6 </code></pre> <p>I also cannot call any other methods. In fact, it seems I can't call any Type Library methods.</p> <p>What am I doing wrong?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload