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"); #} }

In reply to Automation with GUITest by shayak

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.