require 'firewatir' 
require 'watir'
require 'win32ole' 
require 'rubygems'
ai = WIN32OLE.new("AutoItX3.Control") 
ie=FireWatir::Firefox.new
#Go to AutoIt website 
ie.goto("http://www.autoitscript.com/autoit3/downloads.shtml") 
#Click Download AutoIt image 
ie.image(:alt,'Download AutoIt').click
#Wait for the pop-up window with the specified title supplied to come 
res=ai.WinWait("Opening autoit-v3-setup.exe","",30) 
puts res 
#Always try to Activate the pop-up window before using ControlClick fn() 
res=ai.WinActivate("Opening autoit-v3-setup.exe") 
puts res 

ai.Send ("{ENTER}")
#Click on the specified control on the pop-up window 
#res=ai.ControlClick('Opening autoit-v3-setup.exe','','Save File') 
#puts res 
#puts"\n" 
#Wait for the pop-up window with the specified title supplied to come 
#res=ai.WinWait("Save As","",30) 
#puts res 
#Always try to Activate the pop-up window before using ControlClick fn() 
#res=ai.WinActivate("Save As") 
#puts res 
#Send the path in the pop-up window where you want to store the respective file 
#res=ai.ControlSend("Save As","","Edit1", "C:\AutoItV3.exe") 
#puts res 
#Click on the specified control on the pop-up window 
#res=ai.ControlClick("Save As","","&Save") 
#puts res 