565RE: [perlguitest] GetComboContents and GetComboText newbie proble m.
- Sep 8, 20041. You should probably try running your code with the -w switch to Perl
(perl -w program.pl) or add the 'use warnings' pragma to your code; among
possibly other things, it should tell you that @combo_boxes is better
written as $combo_boxes.
2. Is there a reason you are using $combo_boxes? You set up @combo_boxes
to be an array of all the windows under IE that has a class matching
'InternetExplorer_TridentCmboBx'. But then you don't check if you actually
get any windows returned (e.g., die "No CBs found" unless @combo_boxes). You
then start using the second element returned (); why not the first one
()? Or any others that might be returned? Are you sure there even is a
second element returned? You should probably consider iterating across all
of the returned windows in @combo_boxes and see if a different one has what
you're looking for.
3. This is more of just an optimization, but I'm pretty sure you don't have
to call GetComboText on each element of the combo box. You should already
have all of the element text in @contents when you call GetComboContents.
Hope some of that helps.
From: robert529742 [mailto:viruskiller@...]
Sent: Friday, 03 September, 2004 03:44
Subject: [perlguitest] GetComboContents and GetComboText newbie problem.
Apologies if this is a double post.
I am having some problems with the GetComboContents and/or
Having identified the combo box I want text values out of I call
getcombocontents into an array and then call getcombotext on each of
the entries in that array.
However - instead of returning the text of the combo box contents
this code returns a single byte, possibly a pointer or lookup to the
actual text. possibly something completely different. I want the
text and it's driving me loopy.
I have tried a few variations of iterating through the @contents
array, tried doing it in different places in the code, nothing seems
to work. I just get a single raw byte back for each entry in the
box. I know this is the right box because there are 26 entries in
it, no other box on the page has 26 options.
Heres the code I am using.
use Win32::GuiTest qw/SendKeys FindWindowLike GetComboContents
my @contents = ();
#Find the IE window I want
my ($ie_window) = FindWindowLike(0, "Bob", "IEFrame");
#Check I have found it
die "Bob is not a window on the screen" unless $ie_window;
#Find the combo boxes on the page ( I think )
@combo_boxes = FindWindowLike
#theres a few combo boxes, this is the one I want.
@contents = GetComboContents(@combo_boxes);
#Determine how big it is..
#Iterate through it getting the text and printing it. only it gets a
#single byte lookup, 4 "smiley face" characters
#like you get if you dump executables to the screen.
Any help most gratefully appreciated. What on earth am I doing wrong
here, and is it completely wrong or just a bit wrong.
Yahoo! Groups Sponsor
Yahoo! Groups Links
To visit your group on the web, go to:
To unsubscribe from this group, send an email to:
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
- Next post in topic >>