Loading ...
Sorry, an error occurred while loading the content.

GetComboContents and GetComboText

Expand Messages
  • robert529742
    Hey. My first posting to this group, be gentle! I am having problems with a bit of code to retrieve the contents of a combo box. I can identify the box, get
    Message 1 of 1 , Sep 2, 2004
    • 0 Attachment
      Hey.

      My first posting to this group, be gentle!

      I am having problems with a bit of code to retrieve the contents of
      a combo box. I can identify the box, get it's contents (or at least
      the same number of items as I am expecting so I assume it's the
      right box) but every time I try to get them I get a single byte back.

      Heres the code.

      use Win32::GuiTest qw/SendKeys FindWindowLike GetComboContents
      GetComboText GetListText/;
      use strict;

      my $target="";
      my $text="";
      my $i=0;

      my ($ie_window) = FindWindowLike(0, "Some Webpage", "IEFrame");
      my (@combo_boxes) = FindWindowLike($ie_window,"", "Internet
      Explorer_TridentCmboBx");
      my (@contents) = GetComboContents(@combo_boxes[1]);
      foreach (@contents)
      {
      $i++;
      }
      my $size=$i;
      $i=0;
      while ($i<$size)
      {
      $text=GetComboText(@combo_boxes[1],$i);
      print "$text\n";
      $i++;
      }

      All very easy. Or so it would seem, but all I get back in the $text
      variable, where I would expect the text each of the items in the
      combo box, is a single byte of data for each item. I cant post what
      I see (smiley faces and umlauts etc) but I think it's just a hex
      reference that STDOUT tries to render as text.

      Theres the correct number of these, also they differ slightly so I
      am pretty sure I am iterating through the array correctly .. wheres
      my text? What's the method to get the text? Where am I going wrong?

      Any help gratefully Appreciated.

      Thanks.

      -Ed.
    Your message has been successfully submitted and would be delivered to recipients shortly.