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

RE: [perlguitest] Re: wmgettext problem

Expand Messages
  • Chris Hilton
    One recommendation: ($totalWin) = FindWindowLike(undef, undef, Edit , undef, undef); Since you ve passed undef as the first parameter to FindWindowLike(),
    Message 1 of 6 , Jun 25, 2004
    • 0 Attachment
      One recommendation:

      ($totalWin) = FindWindowLike(undef, undef, "Edit", undef, undef);

      Since you've passed undef as the first parameter to FindWindowLike(), you're
      searching every window in the system and, depending on the other
      applications running, there's a good chance one of them will have an Edit
      window you might end up with instead. If you put $win (the window handle to
      Calculator in your example code) as the first parameter, it will search only
      the children of that window and you should get the right one.

      As for window information, I use Spy++ myself and noticed that what it calls
      Caption matches what you would use for titleregex, Class is just the class
      name, and childid is just the window handle? Also, it's worth remembering
      that they are regular expressions, so "Edit" will match the class "Edit",
      "SysEdit32", "FooBarEdit", etc. You can make it "^Edit$" to ensure an exact


      -----Original Message-----
      From: obvtech [mailto:obvtech@...]
      Sent: Thursday, 24 June, 2004 23:45
      To: perlguitest@yahoogroups.com
      Subject: [perlguitest] Re: wmgettext problem

      I finally got it working on my system at home. The one problem I see
      with the way I was able to pull the information, is it's obviously
      different depending on which version of OS you have. On my system at
      work, the total field in the calculator has the class name of Static,
      but at home it's a class name of Edit. This could really affect
      portability between systems. Here's the solution I came up with (it's
      quite simple).

      ($totalWin) = FindWindowLike(undef, undef, "Edit", undef, undef);
      $text = WMGetText($totalWin);
      print "$text \n";

      I came up with this thanks to some help by Chris, and by modifying it
      according to the readme.html file accompanying the package. I noticed
      there are other identifiers within the FindWindowLike function that
      might be better suited, but I can't seem to find them in the WinSpy++
      with anything closely resembling the same naming. If anyone knows how
      to find the proper parameters, it might be helpful to post it here.
      I've been doing automation for the past 3 or 4 years with packaged
      software and know how painful it can be if controls can't be
      identified without being tabbed to. Here are the parameters from the
      readme file.


      I've left the same number of parameters in my solution just to show
      where each of the different ones would go. As you can see I used the
      classregex even thought I doubt it's terribly reliable. If anyone
      knows where you could find the other parameters in a program like
      WinSpy I'm certain it would help a lot of people (including myself).

      And thanks for the help Chris. Once I get to know this module well
      enough, you can guarantee I'll do my best to help others out.
    Your message has been successfully submitted and would be delivered to recipients shortly.