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

1265Re: How to know button is enabled or disabled?

Expand Messages
  • Dennis K. Paulsen
    Jan 8, 2006
    • 0 Attachment
      Hello,

      1) Make sure your using "use strict;" and "use warnings;" to catch
      many common coding errors.
      2) I assume $BName is defined somewhere, and that it doesn't contain
      the regular expression syntax ^ \ since your not using the regexp
      comparison =~ when you compare $buttonName against $BName.
      3) IsWindowEnabled takes a window handle, therefore you could use $_
      as its parameter given your code. Currently your sending it a button
      name.
      4) IsWindowEnabled returns a boolean value, therefore comparing it
      against the text string 'TRUE' is not valid. You could use "if ($res)
      {" instead.
      5) Try not to hardcode coordinates (150, 305)... You might consider
      using PushButton or MouseClick functions to help.


      Regards,
      DKP

      --- In perlguitest@yahoogroups.com, "ashastry06" <aparnashastry@h...>
      wrote:
      >
      > Hi,
      > I want to click the button only, if the button is enabled. if not
      > do something else. Please tell what am I doing wrong? Attaching part
      > of my code.
      >
      >
      > my @childern = GetChildWindows($_);
      > for (@childern) {
      > $buttonName = WMGetText($_);
      > print $buttonName,"\n";
      > $className = GetClassName($_);
      > # $BName == ("^\&Options" );
      >
      > if ($buttonName == $BName ) {
      > $res = IsWindowEnabled($BName) ;
      > if($res == 'TRUE'){
      > MouseMoveAbsPix($x+150,$y+305);#Options
      > SendMouse("{LEFTCLICK}");
      > print "in while loop","\n";
      > }
      > print "out of while loop","\n";
      > }
      > else {
      > print "whoops","\n";
      > }
      >
      > }
      >
      >
      > Thanks,
      > Aparna
      >
    • Show all 3 messages in this topic