#Region ; Make 64Bit EXE
#AutoIt3Wrapper_UseX64=y
#EndRegion
;screencapture library
#include <ScreenCapture.au3>
;dos mode on
#pragma compile(Console, True)
ConsoleWrite(@CRLF & 'Screen capture tool written by Juan Calderon v.1.1 x64 24.04.22' & @CRLF)
ConsoleWrite('Distributed as is, free to use for commercial and non-commercial use. ')
ConsoleWrite('Source: https://xuan.guru/?p=342' & @CRLF & @CRLF)
Sleep (500)
; call the capture routine
Smile()
Func Smile()
;command line parameter
Local $tell_me_where_save_it, $rezX , $rezY, $rezX1 , $rezY2
; if I have one parameter then lets take the screenshot
if $cmdline[0]=5 Then
;grab the one parameter, the path/filename
$tell_me_where_to_save_it=$cmdLine[1]
;grab coordinates data
$rezX = $cmdLine[2]
$rezY = $cmdLine[3]
$rezX1 = $cmdLine[4]
$rezY1 = $cmdLine[5]
_ScreenCapture_Capture($tell_me_where_to_save_it,$rezX,$rezY,$rezX1,$rezY1)
ConsoleWrite('Screen capture taken, saved to file ' & $tell_me_where_to_save_it & '.' & @CRLF)
;If you dont hear a beep then something went wrong
if @error Then
Else
Beep(500, 650)
EndIf
;So you didn't give me 5 parameters or too many
Else
; quick help comment.
ConsoleWrite('Usage: cap filename.jpg coord_start_X coord_start_Y coord_end_X coord_start_Y' & @CRLF & @CRLF)
ConsoleWrite('cap myscreen.jpg 0 0 1280 1080 - capture main screen 1080p' & @CRLF & 'cap d:\save_here\myscreen.jpg -1280 0 0 -1080 - capture secondary screen to the left' & @CRLF)
EndIf
EndFunc ;Done
ChangeLog
V1.1 24.04.22
- Tiny delay added so the console write would be given time to print before capture takes place otherwise on some systems it truncates the message.
- Audio alert, a beep sound is make if no errors took place, if you dont hear anything then something went wrong saving the file.
V1 23.03.22
- Bugs persisted where it would not detect the resolution correctly on some systems, to bypass this I implemented passing capture region parameters to make it manual.
Known bugs
-Using display docks confuse the program, its likely I will never resolve this.
Posted on March 27, 2022, 5:52 pm By xuan
Categories: tech tips Tags: autoIT, screen capture