Hi it's me again :P
I found a way how to get that working.
at this moment code is very primitive, but it do what i want. ofc ill post the code below, because maybe someone may need it, and will modify it by himself. This is my first week with perl (and i don't know any other programming language). I have to say it again it's VERY PRIMITIVE JUST FOR TEST. GOTO made code slower. Just put it here, to check if it's works.
use Imager;
use Imager::Screenshot 'screenshot';
use Win32::GuiTest qw(FindWindowLike GetWindowText
SetForegroundWindow SendKeys);
START:
my $img = screenshot(); #make screenshot
$img->write(file => 'screenshot.png', type => 'png' ) ||
print "Failed: ", $img->{ERRSTR} , "\n"; #write a new sreenshot o
+ver old one
#or send error
$img=Imager->new(); #make new image
$img->read(file=>'screenshot.png',type=>'png'); #read from fresh scre
+enshot
$color = $img->getpixel(x=>68, y=>58); #get pixel from coord
+inate x,y
$img1=Imager->new(); #make new image
$img1->read(file=>'orginal.png',type=>'png'); #1.read from orginal
+pcitrue i have made
$color1 = $img1->getpixel(x=>68, y=>58); #2. before to compar
+e element from
$keys = (22); #3. the same coordina
+tes, so when
#4. window is change
+on any diferent color
#5. program show doin
+ code (else)
if ($color->equals(other=>$color1)) { #if color is the same
print "ok\n" #print ok, do nothing.
}
else { #else press key 22 from $key
+s
SendKeys ($keys, 100)
}
sleep 1; #sleep for one sec
goto START; #go back and do compare aga
+in with new screenshot