kiven26 / robotframework-autoitlibrary

Automatically exported from code.google.com/p/robotframework-autoitlibrary
Apache License 2.0
0 stars 0 forks source link

Add support for IronPython #21

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I would like to see a version of this library that works with IronPython.

If we replace this line:

        self._AutoIt = win32com.client.Dispatch("AutoItX3.Control")

... with these lines:

        from System import Type, Activator
        self._AutoIt = Activator.CreateInstance(Type.GetTypeFromProgID("AutoItX3.Control"))

... it at least allows the library to load. However, when I do that, none of 
the methods in the dll are being exposed as robot keywords so there must be a 
bit more to do.

Original issue reported on code.google.com by bryan.oa...@gmail.com on 29 Feb 2012 at 9:43

GoogleCodeExporter commented 8 years ago
I neither know nor have access to Iron Python, so I don't think I can be much 
help here.  What I can explain is the "magic" behind this line of code that 
you're trying to change:
    self._AutoIt = win32com.client.Dispatch("AutoItX3.Control")

The setup.py file does this:
#
# Make sure we have win32com installed
#
makepy = os.path.normpath(os.path.join(get_python_lib(), 
"win32com/client/makepy.py"))
if not os.path.isfile(makepy) :
    print "AutoItLibrary requires win32com. See http://starship.python.net/crew/mhammond/win32/."
    sys.exit(2)

cmd = "python %s %s" % (makepy, instFile)
print "Running '%s' to make Python aware of AutoItX3.dll" % cmd
subprocess.check_call(cmd)

The result of running makepy.py once on the AutoItX3.dll file is that it 
creates some "hidden magic" files that work with 
win32com.client.Dispatch("AutoItX3.Control") to expose the methods in the .dll 
to Python reflection.

To make this work with Iron Python, you'll need some similar mechanism to 
expose the methods inside the AutoItX3.dll file to Python reflection.  If that 
exists in Iron Python, then you should be able to get it to work.

Original comment by c.martin...@gmail.com on 29 Feb 2012 at 10:19