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


I am trying to use the above -mentioned function in my code but it failed. Here's a snapshot of it;

my $win = new MainWindow;

$win->title("Main Window");

configureColors();

my $win_title = $win->cget('title');

if (FindWindowLike(undef,$win_title,""))

{

print STDOUT "$win_title\n";

}

When I executed the program, it gave me the following error:

Undefined subroutine &main::FindWindowLike called at ./intellibuild.pl line 628.

I read at http://www.perl.com/pub/a/2005/08/11/win32guitest.html? page=1

that I have to include Win32::GuiTest module in order to use the function, but what if my program is running on Unix platform? What is the appropriate module that I need to include?

2) My objective is to find a window with a matching title. Once that is found, how do I "set focus" based on the ID/title of the window so that I can manipulate the widgets inside it?

Thanks in advance.

Regards
-Mawardi
  • Comment on Problems in Using FindWindowLike Function

Replies are listed 'Best First'.
Re: Problems in Using FindWindowLike Function
by Corion (Patriarch) on Oct 20, 2008 at 08:58 UTC

    Modules with names of operating systems (or classes of operating systems) in their name most likely only work on their respective operating systems. For example the Win32:: modules likely only work on the family of Windows operating systems.

    So you will need to either switch to Windows for your program or maybe use X11::GUITest. You haven't told us what problem you're trying to solve, so it's hard to give you more specific help.

Re: Problems in Using FindWindowLike Function
by apl (Monsignor) on Oct 20, 2008 at 10:00 UTC
    Is FindWindowLike in intellibuild.pl, or in a module you use? Did you check that the actual function has capital 'f', 'w' and 'l' in its name?
      He says I read at http://www.perl.com/pub/a/2005/08/11/win32guitest.html? page=1

      that I have to include Win32::GuiTest module in order to use the function, but what if my program is running on Unix platform? What is the appropriate module that I need to include?

Re: Problems in Using FindWindowLike Function
by psini (Deacon) on Oct 20, 2008 at 09:00 UTC

    Not knowing which modules you are using this is only a wild guess: are you sure that FindWindowLike is a function and not a method of some ($win ?) object?

    Rule One: "Do not act incautiously when confronting a little bald wrinkly smiling man."