When interfacing to a COM object, is it possible to pump messages in a
thread?
I'm working on an application that automates IE and needs to monitor
IE events (yes I know about Pamie). I'm starting IE as follows:
ie = win32com.client.DispatchWithEvents( object, YamieEvents )
ie.event = w
to work but I clearly do not really understand why).
Regards
|-Original Message-
|From: Mark Hammond [mailto:[EMAIL PROTECTED]
|Sent: Tuesday, February 07, 2006 2:30 PM
|To: Richard Bell; python-win32@python.org
|Subject: RE: [python-win32] Is it possible to pump messages in thread?
|
|>
|
ed with minimal effort on your
part. After you've had a chance to look at them feel free to let me know of
any changes that would make them more suitable for your purposes.
Regards,
Richard
|-Original Message-
|From: Mark Hammond [mailto:[EMAIL PROTECTED]
|Sent: Tuesday, February 07
ctical matter the design of my application is such that this may be
relatively easy to accomplish. Any thoughts?
I'll get the first of the STA test out to you a bit later today.
Richard
|-Original Message-
|From: Richard Bell [mailto:[EMAIL PROTECTED]
|Sent: Tuesday, February 07, 2006 6
I'm working on an application that does some IE automation via the COM
interface. I'm running in a free thread model, sys.coint_flags = 0, and
starting IE with
win32.com.client.DispatchWIthEvents("InternetExplorer.Application",
event_handler_class). Events are arriving as revealed by print state
d the problem is corrected.
Richard Bell schrieb:
> I'm working on an application that does some IE automation via the COM
> interface. I'm running in a free thread model, sys.coint_flags = 0,
> and starting IE with
> win32.com.client.DispatchWIthEvents(&q
My adventures in IE automation continue. I'm now able to start IE, navigate
to a page, and process events as they occur. Unfortunately, when I try to
reference the document after it is loaded and displayed I encounter a number
of problems.
The relevant code is as follows:
self.ie = win32com.
refactoring you would need to do, but out of curiousity, have you
|thought about using PAMIE? I have used it with quite a lot of success. It
|may not be the answer you are looking for, but you might want to have a
|look
|at it.
|
|http://pamie.sourceforge.net/
|
|-Rex
|
|
|From: "Richard Bell&
I'm working on an application that automated IE in an apartment threaded
model.
I'm trying to get back the result of ie.Navigate(). According to the MSDN
documentation it should return a HRESULT. It appears to return None. Is
there a way to get the return code from the com interaction?
Thanks.
age-
|From: Mark Hammond [mailto:[EMAIL PROTECTED]
|Sent: Saturday, May 26, 2007 3:17 AM
|To: 'Richard Bell'; python-win32@python.org
|Subject: RE: [python-win32] Getting HRESULT back from a com automation
|
|> I'm trying to get back the result of ie.Navigate().
|> According to t
My misunderstanding.
As far as I know now absent some error all I really expect is S_OK. I'm
adding in the python.com_error checking now and starting careful testing.
If something other than S_OK turns up in the IE interface I'll let you know.
Thanks.
Regards,
Richard
|> As to what codes I'm ex
Can pythoncom.PumpWaitingMessages() generate a COM error? In particular if
there is a running instance of IE that is terminated by some external event,
say the user or a script, will pythoncom.PumpWaitingMessages() generate a
COM error since the automation object is gone?
Thanks for any clues.
The GenPY output for IE contains two _dispid_to_func list:
_dispid_to_func_ = {
101 : "OnNavigateComplete",
103 : "OnQuit",
201 : "OnFrameNavigateComplete",
108 : "OnProgressChange",
I'm having trouble using the GetProperty and PutProperty COM interfaces with
IE. Example:
>>> import win32com.client
>>> ie = win32com.client.Dispatch('InternetExplorer.Application')
>>> ie.visible
>>> ie.Navigate('www.google.com')
So there's an IE with a loaded page.
>>> dir(ie)
['CLSID', 'Cli
Tim,
You are, of course, completely right as this example which may be useful to
others shows.
>>> import win32com.client
>>> ie=win32com.client.Dispatch('InternetExplorer.Application')
>>> ie.Visible=True
>>> ie.Navigate('www.cnn.com')
>>> ie.PutProperty('aProperty', 'this is the value')
>>> ie.
This group has been very helpful as I've worked on an IE automation class
(yes I know about Pamie). I recently encountered a design issue concerning
how to allow users to 'hook' event routines in the IE automation class.
After a bit of thought and scratching around I decided to look into a user
d
I'm continuing to work on a class to automate IE in an apartment-threaded
early binding class. The current design is relatively conventional and
looks like this:
class Yie(object):
def __init__(self, eventClass):
--- code deleted ---
self._ie = win32com.client.DispatchWithEv
o be
pumped. I do not remember where I read this or why it is so. Such,
however, is NOT the case with OnDocumentComplete. So I'm still a bit
uncertain.
Do you know of any hard test to verify the behavior?
Regards,
Richard
|Tim Roberts, [EMAIL PROTECTED]
|Richard Bell wrote:
Thanks Tim and Mark. I appreciate your help. BTW Mark, I'm the same
Richard Bell you helped in this area about a year ago and worked on the IE
examples in the current distribution.
Tim Roberts wrote
|Yes, that's right. I didn't see your earlier post. When did you send
|that?
Tim Roberts wrote
|These are synchronous events. That is, these events are generated
|directly by the requests you made. I believe you will find that the
|"OnVisible" callback occurs before "ie.Visible = 1" returns. It's being
|handled by that same thread, which is suspended waiting for IE to
Tim Roberts wrote
|It's quite possible for a single callback to happen both synchronously
|and asynchronously, depending on context. In this case, IE probably
|considers the StatusBar to be one of its "commands", so the
|OnCommandStateChange makes some sense.
Is it then the case that my OnEvent r
Tim,
Thanks again. Your assistance has been extremely helpful.
I've modified the test routine to illustrate the substance of our exchange
and am posting it by way of giving something back to the group and in the
off chance that it may prove useful to others.
BTW, I'm still a bit concerned abo
When DispatchWithEvents is used a new object is returned that (according to
the code on sourceforge
http://pywin32.cvs.sourceforge.net/pywin32/pywin32/com/win32com/client/__ini
t__.py?revision=1.34&view=markup)
216 It is important to note that the returned instance is not a direct
217 ins
My apologies if this has already been sent but I did not receive a post
acknowledgement.
|Tim,
|
|Thanks again. Your assistance has been extremely helpful.
|
|I've modified the test routine to illustrate the substance of our exchange
|and am posting it by way of giving something back to the grou
I'm trying to debug code for a class to automate IE and am having difficulty
with ShowBrowserBar. I've looked on the Web and found a couple of examples
that suggest this should work:
--- begin code ---
def spin(t):
t0 = time.clock()
while time.clock()-t0 < t: pass
time.clock()
ie=win
>When I run this, (winxp pro, python2.5.1, pywin32 build 210) I get no
>errors. IE pops up and loads the URL. I do not however see any change in
>the browsers state, between the 2 calls of ie.ShowBrowserBar(bar,x,0), with
>x (True, False)
>
>Possible an issue with your configuration or installatio
|Tim Roberts wrote:
|The "browser bar" thing was changed pretty radically between IE6 and
|IE7, so it may just be that the GUIDs are different, or that the other
|bars don't exist in the same universe any more.
Thanks Tim.
I saw some tracks in the web documentation but was NOT clear on what or
Jef,
I'm not sure if this is helpful but you might try taking a look at the Pamie
code for how it gets deals with the DOM.
Additionally the following code snip may be helpful (self is
win32com.Client.Dispatch returned IE object)
Regards,
Richard
- code -
def Dom(self,
er
In my continued work on a COM automation interface for IE I've encountered a
strange/impossible Python behavior. Here's what appears to be the offending
code:
- code -
nodes = self.DomGetNListFilterValue(node, tags, properties, value,
i
bject: Re: [python-win32] Strange/impossible Python COM interface
|behavior
|
|On 7/4/07, Richard Bell <[EMAIL PROTECTED]> wrote:
|>
|> In my continued work on a COM automation interface for IE I've
|encountered a
|> strange/impossible Python behavior. Here
is NOT in the GenPY output code, so I assume it is
also in DispatchBaseClass. I'm guessing that _ApplyTypes_ is misbehaving
but am not sure.
In any event, thanks for your assistance. While not resolved the problem is
not critical since it only involves print and there is a work around via `
produces a zero length string. However print of nodes for other HTML
tags such as HTML, BODY, or DIV produces strings that describe the object.
Second, when the INPUT node named 'q' is returned as an item in a list (see
qNode2) printing the list prints the item. I'm not su
my Python
education yet again. Thanks.
Regards,
Richard
|-Original Message-
|From: Mark Hammond [mailto:[EMAIL PROTECTED]
|Sent: Thursday, July 05, 2007 6:41 PM
|To: 'Richard Bell'; python-win32@python.org
|Subject: RE: [python-win32] Strange/impossible Python COM interface
The following code creates an IE browser, navigates to Google, and then
clicks on the 'News' link.
- code -
ie = win32com.client.DispatchEx('InternetExplorer.Application')
ie.Visible = 1
ie.Navigate('www.google.com')
time.sleep(10)
# show a '.' access fairly deep into the page's DOM (to
I'm a complete neophyte when it comes to window's GUI and need a bit of
help.
I'm working on an application that automated IE and want to draw a flashing
box around screen elements. I can find the coordinates OK but am a bit
unclear on how to actually draw a box in such a fashion that when the
f
e-
|From: [EMAIL PROTECTED] [mailto:python-win32-
|[EMAIL PROTECTED] On Behalf Of Tim Roberts
|Sent: Thursday, July 26, 2007 6:07 PM
|To: Python-Win32 List
|Subject: Re: [python-win32] win32ui and flashing box
|
|Richard Bell wrote:
|> I'm working on an application that automated IE and wan
In an application that automates IE I'm trying to get an HTML nodes screen
coordinates so I can 'flash' the node. Thanks to this list, I'm able to
flash. I can also get the offsets for the node within the 'BODY' tag.
Now all I need is the HWND or screen coordinates of the window holding the
BOD
By way of thanks to Tim (who helped with the flash code) and Mark (who
posted the CastTo clue last year) here's a working example that:
- opens a browser
- navigates to google
- finds the query tag
- flashes it
- finds the button tag
- flashes it
T
Thanks again Tim, I'll make the change.
BTW, anyone looking at this code, should be warned that it only works
properly in a fairly limited set of simple cases. A bit more testing showed
that there are (at least) issues with:
Tags that are off the browser's client area
Tags in fra
Tim,
Did you really mean:
brush = win32ui.CreateBrush(1, 0, 0) # create a brush (hollow, no color)
since the win32gui brush will not select into the device context?
Which brings me to the real question:
What's the difference between win32ui and win32gui anyway and what's the
best online re
I've a COM application that automated IE that I've been working on for some
months. This mourning I get the following error message when I run a test
that ran successfully last night:
=== H2 tag in IFRAME but is NOT visible when the frame is visible, need to
scroll
-- flashTag H2
-- tagScreenCor
I've cleaned up the flash code and am posting it as possibly helpful to
others.
Interestingly, I'm unable to find a way to SetROP2 in win32gui! So the side
discussion about win32gui v. win32ui may be a bit moot. If there is a way
I'd be curious to know what it is as it appears to me that there
I've been working on a class and module to automate IE. All seemed to be
working including several hundred test, so I decided to stress test by
visiting a large number of pages (400 plus) for several hours to see if the
code was stable in the face of repeated use.
After roughly 40 minutes of oper
43 matches
Mail list logo