Win32-GuiTest
view release on metacpan or search on metacpan
milliseconds after the right-click for the window to appear (default
is 50). Zero is returned when no popup menu is found.
DibSect
A class to manage a Windows DIB section. Currently limited in
functionality to 24-bit images. Pulled from old code into GuiTest when I
(jurasz@imb.uni-karlsruhe.de) needed to create several grayscale screen
dumps.
Possible future extenstions: other color resolutions, loading,
comparison of bitmaps, getting from clipboard.
Synopsis:
$ds = new Win32::GuiTest::DibSect;
$ds->CopyWindow($w);
$ds->ToGrayScale();
$ds->SaveAs("bla.bmp");
$ds->ToClipboard();
bool DibSect::CopyClient(hwnd,[rect])
to implement).
bool DibSect::Invert()
Invert the colors in a current DIB section.
bool DibSect::ToGrayScale()
Convert the DibSection to the gray scale. Note that it is still
encoded as 24-bit BMP for simplicity.
bool DibSect::ToClipboard()
Copies the DibSect to clipboard (as an old-fashioned metafile),
so that it can be further processed with your favourite image
processing software, for example automatically using SendKeys.
bool DibSect::Destroy()
Destroys the contents of the DIB section.
UNICODE SUPPORT
Currently (2007) there's no consensus about unicode input in Perl, so
the module declares function "UnicodeSemantics" that sets whether
information queried from windows should use A or W syscalls. The
eg/winbmp.pl view on Meta::CPAN
#!/usr/bin/perl
# $Id: winbmp.pl,v 1.2 2004/03/21 08:05:06 ctrondlp Exp $
# This script has been written by Jarek Jurasz jurasz@imb.uni-karlsruhe.de
# Save a given window as BMP file
# Copy the contents to the clipboard
use Win32::GuiTest qw(:ALL);
($w) = FindWindowLike(0, "^Calc");
$w = GetDesktopWindow unless $w;
$ds = new Win32::GuiTest::DibSect;
$ds->CopyWindow($w);
#$ds->CopyClient(GetDesktopWindow(), \@{[GetWindowRect($w)]});
# Different window, so cache the handle value.
$oldhwnd = $hwnd;
# Get information for the new window in which the cursor is over.
$cur_info = GetWindowInfo($hwnd);
ClearScreen();
# Output window information to console.
DispWindowInfo($cur_info);
# Display menu.
DispMenu();
}
# INSERT to copy window data to clipboard.
if (IsKeyPressed("INS")) {
$Clip->Empty();
$Clip->Set($cur_info);
select(undef, undef, undef, 0.50);
print "Copied data to clipboard.\n";
}
# ESCAPE to exit this program.
if (IsKeyPressed("ESC")) {
print "Goodbye!\n";
last;
}
}
sub ClearScreen {
print "Text: " . WMGetText($hwnd) . "\r\n";
return($info);
}
sub DispWindowInfo {
print shift;
return;
}
sub DispMenu {
print "\n\nPress <INSERT> to copy window text to clipboard.\n";
print "Press <ESCAPE> to exit program.\n";
return;
}
lib/Win32/GuiTest.pm view on Meta::CPAN
=back
=head2 DibSect
A class to manage a Windows DIB section. Currently limited in functionality to
24-bit images. Pulled from old code into GuiTest when I (jurasz@imb.uni-karlsruhe.de)
needed to create several grayscale screen dumps.
Possible future extenstions: other color resolutions, loading, comparison of bitmaps,
getting from clipboard.
Synopsis:
$ds = new Win32::GuiTest::DibSect;
$ds->CopyWindow($w);
$ds->ToGrayScale();
$ds->SaveAs("bla.bmp");
$ds->ToClipboard();
=over 8
lib/Win32/GuiTest.pm view on Meta::CPAN
Invert the colors in a current DIB section.
=item bool DibSect::ToGrayScale()
Convert the DibSection to the gray scale. Note that it is still encoded as 24-bit
BMP for simplicity.
=item bool DibSect::ToClipboard()
Copies the DibSect to clipboard (as an old-fashioned metafile), so that it can
be further processed with your favourite image processing software, for example
automatically using SendKeys.
=item bool DibSect::Destroy()
Destroys the contents of the DIB section.
=back
=cut
lib/Win32/GuiTest/Examples.pm view on Meta::CPAN
use strict;
use Win32::GuiTest::Cmd qw(WhichExe);
print WhichExe(shift);
=head2 eg/winbmp.pl
#!/usr/bin/perl
# This script has been written by Jarek Jurasz jurasz@imb.uni-karlsruhe.de
# Save a given window as BMP file
# Copy the contents to the clipboard
use Win32::GuiTest qw(:ALL);
($w) = FindWindowLike(0, "^Calc");
$w = GetDesktopWindow unless $w;
$ds = new Win32::GuiTest::DibSect;
$ds->CopyWindow($w);
#$ds->CopyClient(GetDesktopWindow(), \@{[GetWindowRect($w)]});
lib/Win32/GuiTest/Examples.pm view on Meta::CPAN
# Different window, so cache the handle value.
$oldhwnd = $hwnd;
# Get information for the new window in which the cursor is over.
$cur_info = GetWindowInfo($hwnd);
ClearScreen();
# Output window information to console.
DispWindowInfo($cur_info);
# Display menu.
DispMenu();
}
# INSERT to copy window data to clipboard.
if (IsKeyPressed("INS")) {
$Clip->Empty();
$Clip->Set($cur_info);
select(undef, undef, undef, 0.50);
print "Copied data to clipboard.\n";
}
# ESCAPE to exit this program.
if (IsKeyPressed("ESC")) {
print "Goodbye!\n";
last;
}
}
sub ClearScreen {
lib/Win32/GuiTest/Examples.pm view on Meta::CPAN
print "Text: " . WMGetText($hwnd) . "\r\n";
return($info);
}
sub DispWindowInfo {
print shift;
return;
}
sub DispMenu {
print "\n\nPress <INSERT> to copy window text to clipboard.\n";
print "Press <ESCAPE> to exit program.\n";
return;
}
=cut
( run in 0.958 second using v1.01-cache-2.11-cpan-81fc1098f69 )