Jump to content

Recommended Posts

Posted

Hi, I was just going over things i've learnt with autoit and put this screen capture tool together and thought i'd share

#cs ----------------------------------------------------------------------------

 Author:            Aaron Marsh

 Script:            Screen Capture Utility

#ce ----------------------------------------------------------------------------

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ScreenCapture.au3>

$Destination = @DesktopDir

;GUI
$Form1 = GUICreate("Screen Capture Utility", 601, 210, -1, -1)
GUISetState(@SW_HIDE)

;Labels
$LABEL1 = GUICtrlCreateLabel("Where would you like to save the Screenshot", 24, 24, 312, 22)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
GUICtrlSetColor(-1, 0x000000)
$LABEL2 = GUICtrlCreateLabel("Choose a Name for your Image", 24, 78, 312, 22)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
GUICtrlSetColor(-1, 0x000000)

$SAMPLE_LABEL = GUICtrlCreateLabel("SAMPLE", 448, 184, 47, 17)

;Input
$INPUT = GUICtrlCreateInput(@DesktopDir, 24, 48, 233, 21)
$NAME_INPUT = GUICtrlCreateInput("ScreenShot", 24, 102, 233, 21)

;Buttons
$BROWSE_BUTTON = GUICtrlCreateButton("Browse", 262, 46, 75, 25, $WS_GROUP)
$SAVE_BUTTON = GUICtrlCreateButton("SAVE", 24, 168, 75, 25, $WS_GROUP)
$EXIT_BUTTON = GUICtrlCreateButton("EXIT", 262, 168, 75, 25, $WS_GROUP)


HotKeySet("{PRINTSCREEN}", "_PrtSc")
Func _PrtSc()
    HotKeySet("{PRINTSCREEN}")
;Capture & Save
;Capture full screen
$TEMP_IMAGE = _ScreenCapture_Capture ("")
; Save bitmap to file
_ScreenCapture_SaveImage (@TempDir & "\TempScreenCapture.jpg", $TEMP_IMAGE)
;&
$THUMBNAIL = GUICtrlCreatePic(@TempDir & "\TempScreenCapture.jpg", 360, 8, 217, 169)
GUISetState(@SW_SHOW)
    HotKeySet("{PRINTSCREEN}", "_PrtSc")
EndFunc

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
$Form1 = GuiSetState(@SW_HIDE)
EndSwitch

;Exit Button
Select
        Case $nMsg = $EXIT_BUTTON
            Exit
EndSelect

;Browse
Switch $nMsg
        Case $BROWSE_BUTTON
            _BrowseDestination()
EndSwitch

;Browse
Switch $nMsg
    Case $SAVE_BUTTON
            _SaveButton()
EndSwitch

WEnd

;Functions
;Browse Button
Func _BrowseDestination()
    $DESTINATION = FileSelectFolder("Select destination", "" , 7)
    GUICtrlSetData($INPUT, $DESTINATION)
EndFunc

;Save Button
Func _SaveButton()
            $GET_SAVE_NAME = GUICtrlRead($NAME_INPUT)
        GUICtrlSetData($NAME_INPUT, $GET_SAVE_NAME)
            FileCopy(@TempDir & "\TempScreenCapture.jpg", $DESTINATION & "\" & $GET_SAVE_NAME & ".jpg", 1)
            FileDelete(@TempDir & "\TempScreenCapture.jpg")
            MsgBox(0,"",$DESTINATION & "\" & $GET_SAVE_NAME & ".jpg" & " " & "Has Been Successfully Saved")
EndFunc

Let me know what you think.

Thanks

Posted

Hi, thanks for looking, I tried it on 7 but im not quite sure what you mean by aero style not visible, could you elaborate please?

thanks

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
  • Recently Browsing   0 members

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