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

GetComboContents and GetComboText newbie problem.

Expand Messages
  • robert529742
    Hi. Apologies if this is a double post. I am having some problems with the GetComboContents and/or GetComboText functions. Having identified the combo box I
    Message 1 of 1 , Sep 3, 2004
    • 0 Attachment
      Hi.

      Apologies if this is a double post.

      I am having some problems with the GetComboContents and/or
      GetComboText functions.

      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
      GetComboText GetListText/;
      use strict;

      my @combo_boxes=();
      my @contents = ();
      my $text="";
      my $i=0;

      #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
      ($ie_window,"", "InternetExplorer_TridentCmboBx");

      #theres a few combo boxes, this is the one I want.
      @contents = GetComboContents(@combo_boxes[1]);

      #Determine how big it is..
      foreach (@contents)
      {
      $i++;
      }

      my $size=$i;
      $i=0;

      #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.
      while ($i<$size)
      {
      $text=GetComboText(@combo_boxes[1],$i);
      print "$text\n";
      $i++;
      }

      Any help most gratefully appreciated. What on earth am I doing wrong
      here, and is it completely wrong or just a bit wrong.

      Thanks.

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