IE OLE automation and multiple windows

I’m using IE to automatically navigate the CMS used where I work. As
part of the process, it pulls up a separate window to choose which
template you want to write with. I do something like this:

require ‘win32ole’

$ie = WIN32OLE.new(‘InternetExplorer.Application’)
$ie.visible = true
$ie.navigate2(‘http://host/path/to/cms/stuff’)

sleep(1) until $ie.readyState == 4

create_page_link = nil
$ie.document.getElementsByTagName(‘a’).each { |a|
create_page_link = a if a.innerHTML =~ /Create New Page/
}

a.click

When this link is clicked, a new window pops up, and I have to navigate
through it to select the template I am using.

However, I can’t figure out how to get an InternetExplorer.Application
instance for this window.

Any clues?

···


Eric Hodel - drbrain@segment7.net - http://segment7.net
All messages signed with fingerprint:
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04