jarmo / RAutomation

RAutomation
MIT License
100 stars 33 forks source link

AutoItX3.dll registration error #17

Closed enkessler closed 13 years ago

enkessler commented 13 years ago

I tried using the :autoit adapter for the first time the other day and was pleased with the results. When I tried using it on a different machine, however, I ran into a problem. In the #load_autoit method the call to regsvr32.exe kept failing. As it turns out this was because I was not running my applications as Administrator and thus did not have the permission to register the needed dll. Once I made the call to regsvr32.exe while an Admin everything worked fine.

It strikes me that this is an issue that should be handled at the time of gem installation and not require additional effort after the fact or blind luck that the dll has already been registered but simply installing the gem through a console that was opened as an Administrator did not seem to do the trick. Is there a good way to handle the registration at install time?

jarmo commented 13 years ago

Yes, administrative permissions are required and we can't register the AutoIt dll when installing since: 1) Rubygems doesn't support that 2) Even if Rubygems would support it, then installing RAutomation would need administrative rights which is also a bad thing 3) Most of the users of RAutomation won't need AutoIt adapter ever - it would be bad to install it during install 4) Longer term goals would be to also add some non-Windows adapters - you can't register that dll on OS X or Linux for sure 5) What adapter to use will be determined only during runtime 6) Can't remember anything else right now

There are many other problems with AutoIt adapter, why i wouldn't recommend using it - for example it won't re-register the dll if you already have some older or newer versions of AutoIt installed. I'd use AutoIt only if there's no other way to do what you're trying to do.

What did the AutoIt adapter do better than WinFfi adapter - maybe we could bring those benefits to WinFfi adapter also?

enkessler commented 13 years ago

Those are all good reasons.

I needed to be able to automate the mouse and I'm not seeing anything in UIAutomation that allows it. At some point I assume the WinFfi adapter will get mouse functionality added through windows messages but I didn't have the time to look into it or do it. I needed a solution in an hour and I knew that AutoIt had mouse functionality right out of the box so it was just a matter of adding a wrapper method to the adapter.

jarmo commented 13 years ago

Yup, that's one way to handle it by having an :adapter => :autoit option for RAutomation::Window.new()