Timothy Barnes
2010-Nov-09 16:06 UTC
[Ironruby-core] Using win32ole "connect" method on Ironruby
When trying to use the connect method inside the win32ole module. Ironruby pops up: "undefined method ''connect'' for WIN32OLE:Class" I see that has been logged as an official issue at: http://ironruby.codeplex.com/workitem/4612 However, it has not been assigned to anyone to fix and previous questions on it went unanswered. I personally have many programs using this method that I would like to use through Ironruby without rewriting using .net methods. Just testing to see if this issue is on anybody''s radar. Is it simple or complex to solve? I understand there are probably many issues more important than this but I am just wanting to know if I need to start rewriting my programs or will this issue be resolved in the near future. Timothy -- Posted via http://www.ruby-forum.com/.
Andrius Bentkus
2010-Nov-09 16:33 UTC
[Ironruby-core] Using win32ole "connect" method on Ironruby
On Tue, Nov 9, 2010 at 5:06 PM, Timothy Barnes <lists at ruby-forum.com> wrote:> When trying to use the connect method inside the win32ole module. > Ironruby pops up: > > "undefined method ''connect'' for WIN32OLE:Class" > > I see that has been logged as an official issue at: > > http://ironruby.codeplex.com/workitem/4612 > > However, it has not been assigned to anyone to fix and previous > questions on it went unanswered. I personally have many programs using > this method that I would like to use through Ironruby without rewriting > using .net methods. > > Just testing to see if this issue is on anybody''s radar. Is it simple or > complex to solve? I understand there are probably many issues more > important than this but I am just wanting to know if I need to start > rewriting my programs or will this issue be resolved in the near future.Why rewriting your programs if you can just add a patch to ironruby?
Timothy Barnes
2010-Nov-09 16:46 UTC
[Ironruby-core] Using win32ole "connect" method on Ironruby
I would love to write a patch to ironRuby. However, I am not sure about how to do that. I am not even really sure where to look for the issue in the ironruby library, nor I do I really have git fully figured out to submit my patch back to ironruby. I am still trying to get up to speed on how all this works (contributing). I will be glad to try. Any direction towards where to find and solve this issue would help! -- Posted via http://www.ruby-forum.com/.
Tomas Matousek
2010-Nov-09 18:10 UTC
[Ironruby-core] Using win32ole "connect" method on Ironruby
Contributing is easy: fork the repo, make the changes, add tests covering the new functionality (ideally as specs to Languages/Ruby/Tests/mspec/rubyspec), run all the tests (irtests command in Languages\Ruby\Scripts), and if everything passes push your changes to your fork and send a pull request to the mailing list. See https://github.com/ironruby/ironruby/wiki/Getting-the-sources Tomas -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Timothy Barnes Sent: Tuesday, November 09, 2010 8:46 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Using win32ole "connect" method on Ironruby I would love to write a patch to ironRuby. However, I am not sure about how to do that. I am not even really sure where to look for the issue in the ironruby library, nor I do I really have git fully figured out to submit my patch back to ironruby. I am still trying to get up to speed on how all this works (contributing). I will be glad to try. Any direction towards where to find and solve this issue would help! -- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core
Andrius Bentkus
2010-Nov-09 18:23 UTC
[Ironruby-core] Using win32ole "connect" method on Ironruby
Checkout(by that I mean get a copy) the code from github. The IronRuby implementation of win32ole is in Languages/Ruby/Libs/win32ole.rb, it uses System.__ComObject from the .NET world to implement the interface (as the header comment tells one). If you are familiar with COM Objects (I am not) and you know how to achieve the functionality of WIN32OLE.connect with System.__ComObject C# then it should be straight obvious what you need to do. Just use some interop magic in win32ole.rb to utilize the .NET world. Your implementation should comply with the standard WIN32OLE implementation in ruby, you can easily look it up in http://ruby-doc.org/stdlib/libdoc/win32ole/rdoc/classes/WIN32OLE.html#M001628, just click [Source]. If you are not familiar with COM in C#, well, there are plenty of tutorials on the net. Just implement the function as clean as possible, commit, add a testcase to Languages/Ruby/Tests/Interop/com/win32ole_spec.rb, commit, verify if it works with your code and the testcase, make a pull request on github. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20101109/ab606280/attachment.html>
Timothy Barnes
2010-Nov-09 19:34 UTC
[Ironruby-core] Using win32ole "connect" method on Ironruby
Thanks for the help. I will see what I can do. Timothy -- Posted via http://www.ruby-forum.com/.
Timothy Barnes
2011-Feb-25 21:24 UTC
[Ironruby-core] Using win32ole "connect" method on Ironruby
It appears to be that the WIN32OLE.connect method cannot be fixed as long as the WIN32OLE is class in IronRuby. This is b/c the connect method substitutes for the new(initialize) method when called. I don''t believe ruby allows you to create a class instance with out calling the new method. Therefore, I see (2) possible solutions: 1. Change WIN32OLE to a module not a class and have the ability to call connect or new. 2. Add a connect method to WIN32OLE class and change the way connect has to be coded to connect to a running instance of an application. I have attached a file showing a possible way to accomplish solution #1. My questions are: Which way should it go? And are there issues that would come up if WIN32OLE were a module and not a class? Thanks for any help on this. Timothy Attachments: http://www.ruby-forum.com/attachment/5968/win32ole_test.rb -- Posted via http://www.ruby-forum.com/.