# Ruby + COM + OLEGEN

**URL:** <https://www.ruby-forum.com/t/ruby-com-olegen/175285>\
**Category:** Ruby\
**Created:** [September 10, 2009, 4:14pm UTC](https://www.ruby-forum.com/t/ruby-com-olegen/175285 "2009-09-10T16:14:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![beer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f04885/32.png) [@beer](https://www.ruby-forum.com/u/beer)\
**Post date:** [September 10, 2009, 4:14pm UTC](https://www.ruby-forum.com/t/ruby-com-olegen/175285/1 "2009-09-10T16:14:06Z")

</div>

Hello.

I have this TLB, and when I run OLEGEN  
(\doc\ruby\ruby-1.8.6\sample\win32ole) I obtain a file that is either  
incomplete or I’m missing something. It only generates only one class  
and 5 modules. If so, how can I run, for example, AcdEvent’s Connect()  
method since there’s no class to instantiate AcdEvent objects? When I  
import the same TLB into VisualStudio, I get a DLL with 3 instantiable  
classes (AcdAutomationServer, AcdEvent and AcdObject). Is this a  
limitation of OLEGEN?

I have attached to this issue the TLB file in question, if anyone can  
tell me how to do this, I would be very, very, very thankful! 😃

Thanks for your time!

---

<div class="post-metadata">

**Author:** ![beer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f04885/32.png) [@beer](https://www.ruby-forum.com/u/beer)\
**Post date:** [September 10, 2009, 4:17pm UTC](https://www.ruby-forum.com/t/ruby-com-olegen/175285/2 "2009-09-10T16:17:05Z")

</div>

Bruno Antunes wrote:

> Hello.
> 
> I have this TLB, and when I run OLEGEN  
> (\doc\ruby\ruby-1.8.6\sample\win32ole) I obtain a file that is either  
> incomplete or I’m missing something. It only generates only one class  
> and 5 modules. If so, how can I run, for example, AcdEvent’s Connect()  
> method since there’s no class to instantiate AcdEvent objects? When I  
> import the same TLB into VisualStudio, I get a DLL with 3 instantiable  
> classes (AcdAutomationServer, AcdEvent and AcdObject). Is this a  
> limitation of OLEGEN?
> 
> I have attached to this issue the TLB file in question, if anyone can  
> tell me how to do this, I would be very, very, very thankful! 😃
> 
> Thanks for your time!

(one thing: posting here since my post to the Google group didn’t went  
through…)

---

<div class="post-metadata">

**Author:** ![beer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f04885/32.png) [@beer](https://www.ruby-forum.com/u/beer)\
**Post date:** [September 10, 2009, 7:09pm UTC](https://www.ruby-forum.com/t/ruby-com-olegen/175285/3 "2009-09-10T19:09:20Z")

</div>

Hello,

At 09/10/2009 11:17 PM, Bruno Antunes wrote:

> > I have this TLB, and when I run OLEGEN  
> > (\doc\ruby\ruby-1.8.6\sample\win32ole) I obtain a file that is either  
> > incomplete or I’m missing something. It only generates only one class  
> > and 5 modules. If so, how can I run, for example, AcdEvent’s Connect()  
> > method since there’s no class to instantiate AcdEvent objects? When I  
> > import the same TLB into VisualStudio, I get a DLL with 3 instantiable  
> > classes (AcdAutomationServer, AcdEvent and AcdObject). Is this a  
> > limitation of OLEGEN?

OLEGEN is for early binding and not tested well.  
Direct Instantiating object from class made by OLEGEN  
is not stable.

Do you know how to instantiate object from these classes in VBScript?  
For example, in VBScript:  
Set acdEvent = CreateObject(“ABC.XYZ”)  
then in Win32OLE:  
acdEvent = WIN32OLE.new(“ABC.XYZ”)

Regards,  
Masaki S.

---

<div class="post-metadata">

**Author:** ![beer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f04885/32.png) [@beer](https://www.ruby-forum.com/u/beer)\
**Post date:** [September 11, 2009, 4:11pm UTC](https://www.ruby-forum.com/t/ruby-com-olegen/175285/4 "2009-09-11T16:11:12Z")

</div>

Masaki S. wrote:

> Hello,
> 
> At 09/10/2009 11:17 PM, Bruno Antunes wrote:
> 
> > > I have this TLB, and when I run OLEGEN  
> > > (\doc\ruby\ruby-1.8.6\sample\win32ole) I obtain a file that is either  
> > > incomplete or I’m missing something. It only generates only one class  
> > > and 5 modules. If so, how can I run, for example, AcdEvent’s Connect()  
> > > method since there’s no class to instantiate AcdEvent objects? When I  
> > > import the same TLB into VisualStudio, I get a DLL with 3 instantiable  
> > > classes (AcdAutomationServer, AcdEvent and AcdObject). Is this a  
> > > limitation of OLEGEN?
> 
> OLEGEN is for early binding and not tested well.  
> Direct Instantiating object from class made by OLEGEN  
> is not stable.
> 
> Do you know how to instantiate object from these classes in VBScript?  
> For example, in VBScript:  
> Set acdEvent = CreateObject(“ABC.XYZ”)  
> then in Win32OLE:  
> acdEvent = WIN32OLE.new(“ABC.XYZ”)
> 
> Regards,  
> Masaki S.

The problem is not creating the CCS application object - it’s the only  
class that I can from OLEGEN’s output. However, AcdEvent should also be  
a class and I can’t instantiate any objects of that type, since OLEGEN’s  
output only gives me a module 😑

Regards,  
Bruno Antunes

---

<div class="post-metadata">

**Author:** ![beer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f04885/32.png) [@beer](https://www.ruby-forum.com/u/beer)\
**Post date:** [September 11, 2009, 11:59pm UTC](https://www.ruby-forum.com/t/ruby-com-olegen/175285/5 "2009-09-11T23:59:48Z")

</div>

Hello,

At 09/11/2009 11:11 PM, Bruno Antunes wrote:

> class that I can from OLEGEN’s output. However, AcdEvent should also be  
> a class and I can’t instantiate any objects of that type, since OLEGEN’s  
> output only gives me a module 😑

What is the result of the following code?

require ‘win32ole’  
WIN32OLE\_TYPE.ole\_classes(“Ccs.tlb”).each do |k|  
puts k.name  
puts k.ole\_type  
puts k.guid  
puts k.progid  
puts “—”  
end

If k.progid or k.guid is nil, then OLEGEN outputs a module.  
Because Win32OLE does not know how to instantiate a Class  
without guid and progid.

Anyway, if you could instantiate AcdEvent object in VBScript,  
then you could instantiate AcdEvent object in Win32OLE.  
If you could not instantiate it in VBScript,  
then you could not instantiate it in Win32OLE.  
And OLEGEN’s output depends on Win32OLE, so OLEGEN’s output is same.

You should ask the provider of CCS how to instantiate  
AcdEvent in VBScript.

Regards,  
Masaki S.
