Hi all,
I've done the Google thing for several days and I'm hitting a blank.
I'm wondering if there's a way to attach to a running IE process (on
Windows) by using win32ole alone. I can do it with watir, ie =
Watir::IE.attach(:url, url), but I may need to do this on platforms that
don't have watir installed.
Thanks in advance for any pointers,
Geoff
···
--
Posted via http://www.ruby-forum.com/.
Hi,
it's certainly possible. In programming ruby you'llfind an example how
to attach to running excel. Then you'll need to find out Explorer's
API - it shouldn't be that hard (see MSDN etc.)
···
On 1/16/07, Geoff Cheshire <gtc@cheshirelaw.com> wrote:
Hi all,
I've done the Google thing for several days and I'm hitting a blank.
I'm wondering if there's a way to attach to a running IE process (on
Windows) by using win32ole alone. I can do it with watir, ie =
Watir::IE.attach(:url, url), but I may need to do this on platforms that
don't have watir installed.
Thanks in advance for any pointers,
Geoff
From looking at the Watir source, it appears that attach calls attach_init,
which calls a method called attach_browser_window. That method calls _find.
You can look at the implementaion here:
http://svn.openqa.org/fisheye/browse/watir/trunk/watir/watir.rb?r=trunk
Since you don't want to depend on Watir, it looks like you may need to
reimplement some of its functionality.
Thanks,
Nate
···
On 1/16/07, Geoff Cheshire <gtc@cheshirelaw.com> wrote:
Hi all,
I've done the Google thing for several days and I'm hitting a blank.
I'm wondering if there's a way to attach to a running IE process (on
Windows) by using win32ole alone. I can do it with watir, ie =
Watir::IE.attach(:url, url), but I may need to do this on platforms that
don't have watir installed.
Thanks in advance for any pointers,
Geoff
--
Posted via http://www.ruby-forum.com/\.
Geoff Cheshire wrote:
I've done the Google thing for several days and I'm hitting a blank.
I'm wondering if there's a way to attach to a running IE process (on
Windows) by using win32ole alone. I can do it with watir, ie =
Watir::IE.attach(:url, url), but I may need to do this on platforms that
don't have watir installed.
The Watir code uses win32ole to implement Watir::IE.attach. Have you
looked at it? It's open source and the latest code is in the repository
on OpenQA.org.
Bret
Geoff Cheshire wrote:
Hi all,
I've done the Google thing for several days and I'm hitting a blank.
I'm wondering if there's a way to attach to a running IE process (on
Windows) by using win32ole alone. I can do it with watir, ie =
Watir::IE.attach(:url, url), but I may need to do this on platforms that
don't have watir installed.
Thanks in advance for any pointers,
Geoff
--
Posted via http://www.ruby-forum.com/\.
IE objects are included in the Windows collection of the Shell object,
so you could do something like the following (code not tested):
shell = WIN32OLE.new('Shell.Application')
shell.Windows.each do | window |
if window.Document.Title == 'Your Title Here'
ie = window
end
end
Mully
David Mullet wrote:
IE objects are included in the Windows collection of the Shell object,
so you could do something like the following (code not tested):
Excellent -- I'll give it a go! Thanks everyone for your help. I've
been wading trough the watir source (oh man, that was a bad pun), but
it's nice to have a small snippet like that to get me started.
Thanks again, and I'll post back if I get it working. (I'm working on a
preview in browser command for the e Text Editor, which uses TextMate
bundles--but Windows doesn't have AppleScript so I'm rewriting those
commands in ruby.)
-Geoff
···
--
Posted via http://www.ruby-forum.com/\.
David Mullet wrote:
shell = WIN32OLE.new('Shell.Application')
shell.Windows.each do | window |
Do you how I'd look for the URL instead of window.Document.Title? I'm
guaranteed to have a file name (with full path), but may not know the
title. Or could you point me to the docs where I could find all the
methods and properties? (I found them from IE, but not for
Shell.Application.)
Thanks again!
Geoff
···
--
Posted via http://www.ruby-forum.com/\.
Geoff Cheshire wrote:
David Mullet wrote:
> shell = WIN32OLE.new('Shell.Application')
> shell.Windows.each do | window |
Do you how I'd look for the URL instead of window.Document.Title? I'm
guaranteed to have a file name (with full path), but may not know the
title. Or could you point me to the docs where I could find all the
methods and properties? (I found them from IE, but not for
Shell.Application.)
Thanks again!
Geoff
--
Posted via http://www.ruby-forum.com/\.
Each item in the the shell's Windows collection is an actual
InternetExplorer object, so once you get to that object you will
utilize the standard IE object's properties and methods:
ie.LocationUrl
ie.LocationName
Here's some IE object docs:
Mully
shell = WIN32OLE.new('Shell.Application')
puts shell.ole_methods
···
On Jan 17, 12:27 pm, Geoff Cheshire <g...@cheshirelaw.com> wrote:
Or could you point me to the docs where I could find all the
methods and properties? (I found them from IE, but not for
Shell.Application.)
David Mullet wrote:
Each item in the the shell's Windows collection is an actual
InternetExplorer object, so once you get to that object you will
utilize the standard IE object's properties and methods:
ie.LocationUrl
ie.LocationName
Here's some IE object docs:
Microsoft Learn: Build skills that open doors in your career
That's it! window.LocationUrl was the ticket.
Thanks for your help!
-Geoff
···
--
Posted via http://www.ruby-forum.com/\.