# AutoIt: Regarging AutoIt usage with Firefox

**URL:** <https://www.ruby-forum.com/t/autoit-regarging-autoit-usage-with-firefox/154280>\
**Category:** Ruby\
**Created:** [November 27, 2008, 8:31am UTC](https://www.ruby-forum.com/t/autoit-regarging-autoit-usage-with-firefox/154280 "2008-11-27T08:31:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![anukulsinghal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/dbc845/32.png) [@anukulsinghal](https://www.ruby-forum.com/u/anukulsinghal)\
**Post date:** [November 27, 2008, 8:31am UTC](https://www.ruby-forum.com/t/autoit-regarging-autoit-usage-with-firefox/154280/1 "2008-11-27T08:31:51Z")

</div>

Hi,

I am trying to automate some operations in Firefox using AutoItX3 dll. I  
am giving a sample script below, and in this both WinExists and WinClose  
return 0 (false), although it should return 1 (true as per AutoIt).

require ‘firewatir’  
require ‘win32ole’

ff = FireWatir::Firefox.new  
autoit = WIN32OLE.new(“AutoItX3.Control”)  
sleep 5.0  
puts autoit.WinExists("[CLASS:MozillaUIWindowClass]")  
sleep 2.0  
puts autoit.WinClose("[CLASS:MozillaUIWindowClass]")

Can anyone let me know what is wrong with this script, or is it not  
feasible?

Thanks,  
Anukul

---

<div class="post-metadata">

**Author:** ![anukulsinghal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/dbc845/32.png) [@anukulsinghal](https://www.ruby-forum.com/u/anukulsinghal)\
**Post date:** [June 17, 2009, 9:38pm UTC](https://www.ruby-forum.com/t/autoit-regarging-autoit-usage-with-firefox/154280/2 "2009-06-17T21:38:54Z")

</div>

I tried it myself and it returns 1 1. This is because you are printing  
first the window exists, and it’s true, so if that window exists the  
winclose will be true too.  
It’s returning 0 to you, because it doesn’t find the window, try using  
the name, not classname.

---

<div class="post-metadata">

**Author:** ![anukulsinghal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/dbc845/32.png) [@anukulsinghal](https://www.ruby-forum.com/u/anukulsinghal)\
**Post date:** [June 17, 2009, 9:56pm UTC](https://www.ruby-forum.com/t/autoit-regarging-autoit-usage-with-firefox/154280/3 "2009-06-17T21:56:52Z")

</div>

Agustin R. wrote:

> I tried it myself and it returns 1 1. This is because you are printing  
> first the window exists, and it’s true, so if that window exists the  
> winclose will be true too.  
> It’s returning 0 to you, because it doesn’t find the window, try using  
> the name, not classname.

Hi Agustin,

Thanks for your reply. Is it possible for you to send me the script you  
have written, so that I can try the same from my end?

Thanks,  
Anukul

---

<div class="post-metadata">

**Author:** ![anukulsinghal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/dbc845/32.png) [@anukulsinghal](https://www.ruby-forum.com/u/anukulsinghal)\
**Post date:** [June 17, 2009, 10:08pm UTC](https://www.ruby-forum.com/t/autoit-regarging-autoit-usage-with-firefox/154280/4 "2009-06-17T22:08:09Z")

</div>

Agustin R. wrote:

> I have the same code that you have, do you have firefox 3.0?? are you  
> using the last version of win32ole and firewatir??

Actually, I have been using a very old version of firewatir (1.2.1),  
firefox (3.0), not sure about the version of win32ole, can you tell me  
what version you are using?

Thanks,  
Anukul

---

<div class="post-metadata">

**Author:** ![anukulsinghal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/dbc845/32.png) [@anukulsinghal](https://www.ruby-forum.com/u/anukulsinghal)\
**Post date:** [June 17, 2009, 10:03pm UTC](https://www.ruby-forum.com/t/autoit-regarging-autoit-usage-with-firefox/154280/5 "2009-06-17T22:03:50Z")

</div>

I have the same code that you have, do you have firefox 3.0?? are you  
using the last version of win32ole and firewatir??
