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

I have written a code to automate installing of applications in windows. But it doesnt work when it encounters radio buttons. Plz help. The code is below:
#! usr/bin/perl #use Win32::Gui; use Win32::GuiTest qw(:ALL); use strict; my $window = FindWindowLike( undef,"[Install*.*|*Setup.*]","" ); while(1) { for($window) { SetForegroundWindow($window); my @hwnds = GetChildWindows($window); foreach(@hwnds) { SetForegroundWindow($_); my $var = GetWindowText($_); print "shayak"; print $var; my $class = GetClassName($_); print $class; #my $child = GetChildDepth(GetDesktopWindow(), $_); #print $child; if ($class == ["*RadioButton"]) { my $id=GetWindowID($_); print $id; #CheckButton(GetWindowID($name); if (WMGetText($id)==(["*agree*" ]or ["*accept*"])) { CheckButton($id); } else { SendKeys{"TAB"}; SendKeys{"UP"}; } } #PushButton("Next" or "Agree" or "Install" or "Yes" or "Fi +nish" or "Done"); SendKeys("~"); } } }

Replies are listed 'Best First'.
Re: Gui Automation using guitest
by Anonymous Monk on Feb 15, 2011 at 07:55 UTC
    More made up syntax
    $class == ["*RadioButton"] WMGetText($id) == ( ["*agree*" ] or ["*accept*"] )
    == doesn't work like that
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: Gui Automation using guitest
by Anonymous Monk on Feb 15, 2011 at 07:20 UTC
    What is this supposed to be?
    PushButton("Next" or "Agree" or "Install" or "Yes" or "Finish" or "Don +e");
    You can't just make stuff up
      it presses the button which has the string next or finish etc. In short it presses the next button..
        it presses the button which has the string next or finish etc. In short it presses the next button..

        No, no it doesn't do that, it cannot. The or operator doesn't work like that.

Re: Gui Automation using guitest
by Sinistral (Monsignor) on Feb 16, 2011 at 13:31 UTC
    Although I hesitate to muddy the waters in a long thread with useful information, it really appears (and you say yourself) that you do not want to be a programmer. What you really want is to automate the interaction of a Microsoft Windows application. Although you are working down the road to better understanding Win32::GuiTest, I would suggest a tool that's somewhat friendlier than a "raw" Perl API: AutoIt. It's got a scripting environment, so you can do programming, but you don't have to. It has a a tool to identify Windows windows and widgets that you could use even if you wanted to do the work in Perl. I highly recommend it.
      Thanks for the suggestion.. Will surely look at it.. For now im almost done with this..