Jump to content
Sign in to follow this  
xan

Capture Image With The Mouse

Recommended Posts

xan

I did here a little program to capture screen using the mouse as a reference selection

#include<Misc.au3>
Local $hDLL = DllOpen("user32.dll")
#include<ScreenCapture.au3>

Global $loop = 1, $fotos = "foto", $loop2 = 1, $pos1 = 0, $pos2 = 0

While $loop
    sleep(100)
    if _IsPressed("01", $hDLL) Then
        $pos1  = MouseGetPos()
        $loop2 = 1
        $loop  = 0
EndIf
WEnd
While $loop2
    if not _IsPressed("01", $hDLL) and $loop2 = 1 Then
    $pos2 = MouseGetPos()
    IniWrite("foto.ini", "foto", "chave", "area.bmp"  &"," & $pos1[0] & "," & $pos1[1] & "," & $pos2[0] & "," & $pos2[1]&"," & 0)
    $var     = IniRead("foto.ini", $fotos, "chave", "0")
    $area    = StringSplit($var,",")
    if $pos1[0] < $pos2[0] and $pos1[1] < $pos2[1]  Then
    _ScreenCapture_Capture($area[1], Number($area[2]), Number($area[3]), Number($area[4]), Number($area[5]))
EndIf
    if $pos1[0] > $pos2[0] and $pos1[1] < $pos2[1] Then
    _ScreenCapture_Capture($area[1], Number($area[4]), Number($area[3]), Number($area[2]), Number($area[5]))
EndIf
if $pos1[0] > $pos2[0] and $pos1[1] > $pos2[1] Then
    _ScreenCapture_Capture($area[1], Number($area[4]), Number($area[5]), Number($area[2]), Number($area[3]))
EndIf
if $pos1[0] < $pos2[0] and $pos1[1] > $pos2[1] Then
    _ScreenCapture_Capture($area[1], Number($area[2]), Number($area[5]), Number($area[4]), Number($area[3]))
EndIf
    DllClose($hDLL)
    $loop2 = 0
EndIf
WEnd

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×