Jump to content

Resizable Screenshot


HankHell
 Share

Recommended Posts

Opens up a semi-transparent resizable GUI window, then takes a screenshot of the size and location with PrintScreen

#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#include <ScreenCapture.au3>

HotKeySet("{PRINTSCREEN}", "Takepic")

$gui = GUICreate("gui", 100, 100, @DesktopWidth /2, @DesktopHeight /2, BitOR($WS_POPUP, $WS_THICKFRAME), $WS_EX_TOPMOST)
GUICtrlCreateLabel("", 0, 0, 100, 100, -1, $GUI_WS_EX_PARENTDRAG)
WinSetTrans($gui, "", 150)

GUISetState(@SW_SHOW)

While 1
    Sleep(100)
    $winsize = WinGetClientSize($gui)
    $winpos = WinGetPos($gui)
WEnd

Func Takepic()
    WinSetTrans($gui, "", 0)
    Local $randomness = Random(0, 999999)
    $randomnumber = Round($randomness)
        _ScreenCapture_Capture($randomnumber&".jpg", $winpos[0]+7, $winpos[1]+7, ($winsize[0]+$winpos[0]+6), ($winsize[1]+$winpos[1]+6))
    Exit
EndFunc

 

Edited by HankHell
typo
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...