Re: Programmatic clicking and new windows
- From: Csaba Gabor <danswer@xxxxxxxxx>
- Date: Mon, 14 Jan 2008 19:49:48 -0800 (PST)
On Jan 11, 9:20 pm, mr_unreliable <kindlyReplyToNewsgr...@xxxxxxxxxxx>
wrote:
Csaba Gabor wrote:....
Subject to the popup blocker, the code below will bring up
two instances of IE. The first one is identified by the
variable ie below. What is the cleanest way to get
ahold of the second one that gets created in the
last line (lnk.click)?
hi Csaba,
You might be able to use the "shell.application" to do
what you want. You can search through the window objects
and find the instances of IE, and then use the document
title to find the specific instance you want.
Here is a script that illustrates this (not exactly, but
close enough).
Example script
....
As you see, look through the windows for type "htmldocument".
Then look for the title. You also have access to the doc
object model for each IE window.
cheers, jw
____________________________________________________________
You got questions? WE GOT ANSWERS!!! ..(but,
no guarantee the answers will be applicable to the questions)
Hi jw,
Thanks for your thoughts, here's a follow up. I am
aware of your approach of iterating through
Set Wins = CreateObject("Shell.Application").Windows
In fact, Eduardo's code would be simplified, methinks,
(and doable in VBScript) if he just compared the hwnd
property of each window within Wins.
The trouble is that neither approach is iron clad.
I found an ancient thread which gave the recommended way at
http://groups.google.com/group/microsoft.public.vb.general.discussion/browse_frm/thread/ada57def698a129/
in RND's last post: he used IE's NewWindow2 event (there
is also NewWindow3). Now this is sort of a funny sort of
creature - the event handler wants its first argument set
to a newly created IE to override the default IE that would
be created. Unfortunately, VBScript can't pass the
modified ByRef argument. So you can watch it, and know
it's about to happen, but you can't do anything about it.
However, PHP is able to work with this event handler
(sort of) and it works. Unfortunately, PHP has a bug
as far as I can tell in setting the (first arg's object) value.
Somewhere in the process they corrupt the variable (the
new IE object), but by then I've got its hwnd (ha ha),
so it is no longer able to hide from me. The problem is
that after running beautifully, this little copying maneuvre
prevents PHP from quitting gracefully - I get a nasty error
each time, presumably reference counts are messed up.
So all I hope is that a developer responds to the bug
report I made.
Regards,
Csaba
.
- Follow-Ups:
- Re: Programmatic clicking and new windows
- From: mayayana
- Re: Programmatic clicking and new windows
- From: mr_unreliable
- Re: Programmatic clicking and new windows
- From: Csaba Gabor
- Re: Programmatic clicking and new windows
- References:
- Programmatic clicking and new windows
- From: Csaba Gabor
- Re: Programmatic clicking and new windows
- From: mr_unreliable
- Programmatic clicking and new windows
- Prev by Date: Re: SOLVED: User info & Computer Name for Range of IP Addresses
- Next by Date: Re: open latest file
- Previous by thread: and another approach...
- Next by thread: Re: Programmatic clicking and new windows
- Index(es):
Relevant Pages
|