Determine if IE has an open modal window win32ole

Does anyone know how to determine if an Internet Explorer window has a
modal window open using only win32ole?

I tried looking in the modal_window.rb and container.rb files in watir
but I cant figure how to do this using only win32ole.

Any help would be appreciated.

Hi,

What version of ruby and watir are you using?

The follow snippet works for me. It handles a modal login dialogue
followed by a java security popup.

def jsClick( a, button, user_inp = nil,rtxt = nil)
waitTime = 60
hwnd1 = $ie.enabled_popup(waitTime) # wait up to 60 seconds for a
popup to appear
if (hwnd1)
w = WinClicker.new
if (rtxt)
popup_text = w.getStaticText_hWnd(hwnd1).to_s.delete “\n”
end
if (user_inp)
w.setTextValueForFileNameField(hwnd1, “#{user_inp}”)
end
sleep 5
w.clickWindowsButton_hwnd(hwnd1, “#{button}”)
w = nil
end
return popup_text
end

Modal login using AutoIt

def login(site,user,pswd,g)
if $Login != 1
a =‘Connect to ’ + site #login dialogue
b = Watir.autoit.WinWait(a,’’,60) #login dialogue present?
puts" #{a}"
if (b==1) #execute only if login dialogue is detected
puts " Login\n"
Watir.autoit.WinWait(a)
Watir.autoit.Send(user)
Watir.autoit.Send(’{TAB}’)
Watir.autoit.Send(pswd)
Watir.autoit.Send(’{ENTER}’)
sleep 1
c = Watir.autoit.WinWait(“Windows Internet Explorer”,’’,10)#
security alert present?
if(c==1)
g.jsClick($ie,“OK”)
end
$Login = 1
end
else
puts"Login not required\n"
sleep 1
c = Watir.autoit.WinWait(“Windows Internet Explorer”,’’,10)
if(c==1)
g.jsClick($ie,“OK”)
end
end
end