473,789 Members | 2,467 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Win 32 - VB, Ruby, Perl VS Python with fireEvent

Hello,

I was wondering if anyone could tell me why fireEvent works in every
language but Python with the latest Internet Explorer?

I tried this page that has two listboxes if you select Listbox A the
Listbox B should change.

The code status:
Works fine with Python 2.3, 2.4 in Windows XPsp1
DOES not work Python 2.3, 2.4 XP Sp2 or the lastest IE
Works fine with "RUBY" on Win 2000, XP sp1 and XP sp2
Work fine with PERL on on Win 2000, XP sp1 and XP sp2

Luckily I know both Ruby, VB and Perl so I could prove there was a
problem.

Here is the example code in both Python and Ruby:

Python:
from win32com.client import DispatchEx
import time


def wait(ie):
while ie.Busy: time.sleep(0.1)

doc = ie.Document
while doc.ReadyState != 'complete': time.sleep(0.1)

ie = DispatchEx('Int ernetExplorer.A pplication')
ie.Visible = 1
ie.Navigate( 'https://enroll.ou.edu/' )
wait(ie)
ie.Document.for ms[0].campus.value=' 200'
ie.Document.for ms[0].campus.fireeve nt('onchange')

Results:
Traceback (most recent call last):
File
"C:\Python23\li b\site-packages\Python win\pywin\frame work\scriptutil s.py",
line 310, in RunScript
exec codeObject in __main__.__dict __
File "C:\automation\ poScript1.py", line 18, in ?
ie.Document.for ms[0].campus.fireeve nt('onchange')
File "C:\Python23\li b\site-packages\win32c om\client\dynam ic.py", line
154, in __call__
return
self._get_good_ object_(self._o leobj_.Invoke(* allArgs),self._ olerepr_.defaul tDispatchName,N one)
com_error: (-2147024891, 'Access is denied.', None, None)

Ruby:
# OU Registration & Enrollment Online
require 'win32ole'
ie = WIN32OLE.new('I nternetExplorer .Application')
ie.visible = true
ie.gohome
ie.navigate('ht tps://enroll.ou.edu/')
while ie.busy
end

READYSTATE_COMP LETE = 4
until
ie.readyState == READYSTATE_COMP LETE
end
form = ie.document.for ms(0)
form.campus.val ue = '200'
form.campus.fir eevent('onchang e')

Results: fireEvent was successful and the second listbox was changed

Jul 18 '05 #1
2 2925
I don't know why case would make a difference, but if I change
the fireevent call to FireEvent, it works on XP sp2.
It also works if you generate the makepy wrappers (probably
because that forces case-sensitivity)

hth
Roger

<ca*****@yahoo. com> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.com.. .
Hello,

I was wondering if anyone could tell me why fireEvent works in every
language but Python with the latest Internet Explorer?

I tried this page that has two listboxes if you select Listbox A the
Listbox B should change.

The code status:
Works fine with Python 2.3, 2.4 in Windows XPsp1
DOES not work Python 2.3, 2.4 XP Sp2 or the lastest IE
Works fine with "RUBY" on Win 2000, XP sp1 and XP sp2
Work fine with PERL on on Win 2000, XP sp1 and XP sp2

Luckily I know both Ruby, VB and Perl so I could prove there was a
problem.

Here is the example code in both Python and Ruby:

Python:
from win32com.client import DispatchEx
import time


def wait(ie):
while ie.Busy: time.sleep(0.1)

doc = ie.Document
while doc.ReadyState != 'complete': time.sleep(0.1)

ie = DispatchEx('Int ernetExplorer.A pplication')
ie.Visible = 1
ie.Navigate( 'https://enroll.ou.edu/' )
wait(ie)
ie.Document.for ms[0].campus.value=' 200'
ie.Document.for ms[0].campus.fireeve nt('onchange')

Results:
Traceback (most recent call last):
File
"C:\Python23\li b\site-packages\Python win\pywin\frame work\scriptutil s.py",
line 310, in RunScript
exec codeObject in __main__.__dict __
File "C:\automation\ poScript1.py", line 18, in ?
ie.Document.for ms[0].campus.fireeve nt('onchange')
File "C:\Python23\li b\site-packages\win32c om\client\dynam ic.py", line
154, in __call__
return
self._get_good_ object_(self._o leobj_.Invoke(* allArgs),self._ olerepr_.defaul tDispatchName,N one)
com_error: (-2147024891, 'Access is denied.', None, None)

Ruby:
# OU Registration & Enrollment Online
require 'win32ole'
ie = WIN32OLE.new('I nternetExplorer .Application')
ie.visible = true
ie.gohome
ie.navigate('ht tps://enroll.ou.edu/')
while ie.busy
end

READYSTATE_COMP LETE = 4
until
ie.readyState == READYSTATE_COMP LETE
end
form = ie.document.for ms(0)
form.campus.val ue = '200'
form.campus.fir eevent('onchang e')

Results: fireEvent was successful and the second listbox was changed



----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
Jul 18 '05 #2
Roger,

Thank you so much! I have been pulling my hair out over this!

Rob.

Roger Upole wrote:
I don't know why case would make a difference, but if I change
the fireevent call to FireEvent, it works on XP sp2.
It also works if you generate the makepy wrappers (probably
because that forces case-sensitivity)

hth
Roger

<ca*****@yahoo. com> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.com.. .
Hello,

I was wondering if anyone could tell me why fireEvent works in every language but Python with the latest Internet Explorer?

I tried this page that has two listboxes if you select Listbox A the Listbox B should change.

The code status:
Works fine with Python 2.3, 2.4 in Windows XPsp1
DOES not work Python 2.3, 2.4 XP Sp2 or the lastest IE
Works fine with "RUBY" on Win 2000, XP sp1 and XP sp2
Work fine with PERL on on Win 2000, XP sp1 and XP sp2

Luckily I know both Ruby, VB and Perl so I could prove there was a
problem.

Here is the example code in both Python and Ruby:

Python:
from win32com.client import DispatchEx
import time


def wait(ie):
while ie.Busy: time.sleep(0.1)

doc = ie.Document
while doc.ReadyState != 'complete': time.sleep(0.1)

ie = DispatchEx('Int ernetExplorer.A pplication')
ie.Visible = 1
ie.Navigate( 'https://enroll.ou.edu/' )
wait(ie)
ie.Document.for ms[0].campus.value=' 200'
ie.Document.for ms[0].campus.fireeve nt('onchange')

Results:
Traceback (most recent call last):
File
"C:\Python23\li b\site-packages\Python win\pywin\frame work\scriptutil s.py", line 310, in RunScript
exec codeObject in __main__.__dict __
File "C:\automation\ poScript1.py", line 18, in ?
ie.Document.for ms[0].campus.fireeve nt('onchange')
File "C:\Python23\li b\site-packages\win32c om\client\dynam ic.py", line 154, in __call__
return
self._get_good_ object_(self._o leobj_.Invoke(* allArgs),self._ olerepr_.defaul tDispatchName,N one) com_error: (-2147024891, 'Access is denied.', None, None)

Ruby:
# OU Registration & Enrollment Online
require 'win32ole'
ie = WIN32OLE.new('I nternetExplorer .Application')
ie.visible = true
ie.gohome
ie.navigate('ht tps://enroll.ou.edu/')
while ie.busy
end

READYSTATE_COMP LETE = 4
until
ie.readyState == READYSTATE_COMP LETE
end
form = ie.document.for ms(0)
form.campus.val ue = '200'
form.campus.fir eevent('onchang e')

Results: fireEvent was successful and the second listbox was changed

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet

News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World!
100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---


Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

220
19169
by: Brandon J. Van Every | last post by:
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have any preconceived ideas about it. I have noticed, however, that every programmer I talk to who's aware of Python is also talking about Ruby. So it seems that Ruby has the potential to compete with and displace Python. I'm curious on what basis it...
54
6578
by: Brandon J. Van Every | last post by:
I'm realizing I didn't frame my question well. What's ***TOTALLY COMPELLING*** about Ruby over Python? What makes you jump up in your chair and scream "Wow! Ruby has *that*? That is SO FRICKIN' COOL!!! ***MAN*** that would save me a buttload of work and make my life sooooo much easier!" As opposed to minor differences of this feature here, that feature there. Variations on style are of no interest to me. I'm coming at this from a...
42
4112
by: Fred Ma | last post by:
Hello, This is not a troll posting, and I've refrained from asking because I've seen similar threads get all nitter-nattery. But I really want to make a decision on how best to invest my time. I'm not interested on which language is better in *general*, just for my purpose. My area of research is in CAD algorithms, and I'm sensing the need to resort to something more expedient than C++, bash scripting, or sed scripting.
4
1471
by: Xah Lee | last post by:
while programing in Python, one can lookup syntax or info for keywords or modules within Python. In the command line, type python to get into the python interactive program. then type help() >From there one can type any keyword or module name to find out the
4
3069
by: Xah Lee | last post by:
# -*- coding: utf-8 -*- # Python # to open a file and write to file # do f=open('xfile.txt','w') # this creates a file "object" and name it f. # the second argument of open can be
4
1906
by: Xah Lee | last post by:
20050207 text pattern matching # -*- coding: utf-8 -*- # Python # suppose you want to replace all strings of the form # <img src="some.gif" width="30" height="20"> # to # <img src="some.png" width="30" height="20"> # in your html files.
41
3558
by: Xah Lee | last post by:
here's another interesting algorithmic exercise, again from part of a larger program in the previous series. Here's the original Perl documentation: =pod merge($pairings) takes a list of pairs, each pair indicates the sameness of the two indexes. Returns a partitioned list of same indexes.
20
4082
by: Xah Lee | last post by:
Sort a List Xah Lee, 200510 In this page, we show how to sort a list in Python & Perl and also discuss some math of sort. To sort a list in Python, use the “sort” method. For example: li=;
3
12379
by: Xah Lee | last post by:
Split File Fullpath Into Parts Xah Lee, 20051016 Often, we are given a file fullpath and we need to split it into the directory name and file name. The file name is often split into a core part and a extension part. For example: '/Users/t/web/perl-python/I_Love_You.html' becomes
0
9657
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9502
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10400
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10132
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9974
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9010
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7523
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
2
3688
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2902
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.