in reply to Re^2: Gui Automation using guitest
in thread Gui Automation using guitest

WMGetText($id) eq ( ["*agree*" ] or ["*accept*"] )

perlop - X or Y means that if X evaluates to true, X is returned. If X evaluates to false, then if Y evaluates to true, the statement returns Y. Otherwise it returns a false value.

["*agree*"] creates a brand new array reference (perlref). Add this to the previous paragraph, and you are comparing one of two brand new array references or false (which will simplify to just the new arrayref ["*agree*"]) to the results of WMGetText($id) to see if they are equal in a string comparison. Very unlikely to return the results you want.

Update: reduce part after eq to just arrayref.

--MidLifeXis

Replies are listed 'Best First'.
Re^4: Gui Automation using guitest
by shayak (Acolyte) on Feb 16, 2011 at 05:40 UTC
    Any suggestion how to go about it? i tried like this if (("agree"|"accept")=~ /WMGetText($id)/)

      Instead of if (("agree"|"accept")=~ /WMGetText($id)/), how about if (WMGetText($id) =~ /^(agree|accept)$/). See perlre for more details.

      --MidLifeXis

        Thanks a lot for ur help. It really helped..