shayak has asked for the wisdom of the Perl Monks concerning the following question:

This is my 4th Post regarding this topic. I have written a code to install any windows application through GUI. Though it works, the problem which i am facing is that, it works only when i hover the mouse on the (next or install) button on the 1st window which comes up. if i take the mouse out of the window the installation pauses. Also in some applications it does press the cancel or back button though i have written in my code to ignore the cancel and back button..
#! usr/bin/perl #use Win32::Gui; use Win32::GuiTest qw(:ALL); use strict; my $window = FindWindowLike( undef,"Setup","" ); while( $window = FindWindowLike( undef,"Setup","" )) { SetForegroundWindow($window); my @hwnds = FindWindowLike(GetChildWindows($window)); #my @hwnds = GetChildWindows($window); foreach (@hwnds) { #SetActiveWindow($_); GetFocus($_); my $WinTxt = GetWindowText($_); print $WinTxt; print "\n"; my $class = GetClassName($_); print $class; if($class =~ /^(TNewRadioButton|radiobutton|Radiobutto +n|RadioButton|Button|TRadioButton)$/) { my $id=GetWindowID($_); my $text = WMGetText($_); #my $wintxt=GetWindowText($child); if ($text =~ /^(I &accept the agreement|agree|Agre +e|Accept|I agree to the terms of this license agreement|Install|insta +ll|I accept the license agreement|I &accept the terms in the License +Agreement)$/) { CheckButton($id) || MouseClick($id); #SendKeys($child); #SendKeys("~"); #PushButton("Next"); } } if($class =~ /^(Checkbox|checkbox|TNewCheckListBox|Che +ckListBox|CheckBox|Button|button|TRzCheckBox)$/) { my $id=GetWindowID($_); my $text = WMGetText($_); #my $wintxt=GetWindowText($id); #print $id; #print "\n"; CheckButton($id) || MouseClick($id); #SendKeys($_); #if ($text =~ /^(I &accept the agreement|agree|Agr +ee|Accept|I agree to the terms of this license agreement|Install|inst +all| I accept the license agreement)$/) #{ #MouseClick($id) && CheckButton($id); #CheckButton($id); #|| MouseClick($id); #PushButton("Next"); #} } if($class =~ /^(Button|button|TNewButton|TButton|&Butt +on)$/) { my $id=GetWindowID($_); my $text = WMGetText($id); #my $wintxt=GetWindowText($id) if($text !~ /^(Cancel|cancel|back|Back|&Back|&Canc +el|&<Back|<back|<Back)$/) { PushButton('Next|Agree|Install|Finish|Done|Ok')||( +PushButton('Select All') && (PushButton('Finish|Next|Agree|Install|Cl +ose|Yes'))) ; } } PushButton('Next|Agree|Install|Finish|Done|Ok')||(Push +Button('Select All') && (PushButton('Finish|Next|Agree|Install|Close| +Yes'))) ;#|| SendKeys("~") ; } PushButton('Next|Agree|Install|Finish|Done|Ok')||(PushBut +ton('Select All') && (PushButton('Finish|Next|Agree|Install|Close|Yes +'))); #SendKeys("~") ; #PushButton("Next" or "Agree" or " Install" or "Yes" or " +Finish" or "Done" or "Select All"); #} }

Replies are listed 'Best First'.
Re: Utomation with GUITest
by Corion (Patriarch) on Mar 17, 2011 at 08:13 UTC
Re: Automation with GUITest
by marto (Cardinal) on Mar 17, 2011 at 11:17 UTC

    Yeah, this is yet another post about the same problem. Read the replies you got in Gui Automation using guitest, don't ignore the advice you've been given.