Tuesday, June 17, 2008

unknown OLE server: `AutoItX3.Control' (WIN32OLERuntimeError)

Symptom
Following error is displayed when we run the script
D:/Installations/Ruby/lib/ruby/gems/1.8/gems/watir-1.5.6/./watir.rb:129:in `initialize': unknown OLE server: `AutoItX3.Control' (WIN32OLERuntimeError)
    HRESULT error code:0x800401f3      Invalid class string      from D:/Installations/Ruby/lib/ruby/gems/1.8/gem
s/watir-1.5.6/./watir.rb:129:in `new'        from D:/Installations/Ruby/lib/ruby/gems/1.8/gems/watir-1.5.6/./watir.rb
:129:in `autoit'        from D:/Installations/Ruby/lib/ruby/gems/1.8/gems/watir-1.5.6/./watir/ie
.rb:425:in `autoit'        from D:/Installations/Ruby/lib/ruby/gems/1.8/gems/watir-1.5.6/./watir/ie
.rb:413:in `bring_to_front'        from D:/Installations/Ruby/Projects/Learning/Create_Company_Order_Servic
es/Verify patch number.rb:41:in `goto'        from D:/Installations/Ruby/Projects/Learning/Create_Company_Order_Servic
es/Verify patch number.rb:47
D:\Installations\Ruby\Projects\Learning\Create_Company_Order_Services>regsvr32 AutoItX3.dll


Solution
You need to register AutoIt. In a command window, navigate to the directory where you've put AutoIt and type:
regsvr32 AutoItX3.dll

7 comments:

Unknown said...

Thank you for your suggestion. When I ran in the cmd prompt it displayed following message window "The module "AutoItX3.dll" failed to load.

Can you help please. Thanks.

Freezing Kiwis said...

Try pointing to where the file actually exists, i.e.


regsvr32 c:\ruby\lib\ruby\gems\1.8\gems\watir-1.6.2\lib\watir\AutoItX3.dll

Chuck van der Linden said...

I saw a similar issue after upgrading a system to Windows 7.. Pretty sure it had been working before that (but job duties had me away from using watir for about 6 months)

registering the DLL took care of it.

Unknown said...

FYI... I discuss registering the AutoItX3.dll using Ruby on my Blog if anyone is interested.

Avatar42 said...

Did not register on my Win 7 64 bit box either. Tried manually and got error 0x80070005 which meant it needed to be done as root. As root it registered. Getting watir-1.6.5/lib/watir/dialog.rb:38:in `click': Watir::Exception::UnknownObjectException
now

Unknown said...

hi david,
thanks for the info and i am facing same issue on my Win 7. can you please provide the steps how to register for root.
regards
Inder

Unknown said...

you don't need to register as root, but as administrator.

What I did was go to the :

C:windows/SysWOW64/
folder
right click on "cmd.exe" => run as administrator.

type :
regsvr32.exe "FULL_PATH_TO_DLL"

example :
regsvr32 c:\ruby\lib\ruby\gems\1.8\gems\watir-1.6.2\lib\watir\AutoItX3.dll


The key part is being using the cmd window as admin