Screen check

Hi,

Is there a way to let Applescript check (a certain part of) your screen, comparing each frame, and after a change of 50% is discovered it will trigger something.
So, let’s say I’ll let Applescript check a certain part of my screen and as soon as my mouse comes in or I’ll drag in a window, it will trigger my keyboard-button “6”.

Thanks in advance,

Jurjen