Ticket #732: guitest.pl

File guitest.pl, 812 bytes (added by kthakore, 4 years ago)

http://search.cpan.org/~karasik/Win32-GuiTest-1.56/lib/Win32/GuiTest/Examples.pm#eg/notepad_text.pl

Line 
1    #!perl -w
2    # If you have a notepad window open this prints the contents.
3   
4    use strict;
5   
6    use Win32::GuiTest qw(FindWindowLike WMGetText);
7   
8    my @windows = FindWindowLike(0, "", "Notepad");
9    die "More than one notepad open\n" if @windows > 1;
10    die "No notepad is running, please open one with some text in it.\n" if not @windows;
11   
12    my $notepad = $windows[0];
13    my @edits = FindWindowLike($notepad, "", "Edit");
14    die "More than one edit inside notepad: " .  @edits . "\n" if @edits > 1;
15    die "No edit window found inside notepad\n" if not @edits;
16   
17    print "----------------------------------------------------------\n";
18    print WMGetText($edits[0]);
19    print "\n";
20    print "----------------------------------------------------------\n";