{"id":342,"date":"2022-03-27T17:52:45","date_gmt":"2022-03-27T17:52:45","guid":{"rendered":"https:\/\/xuan.guru\/?p=342"},"modified":"2022-04-24T15:58:29","modified_gmt":"2022-04-24T15:58:29","slug":"autoit-program-to-screen-capture","status":"publish","type":"post","link":"https:\/\/xuan.co.uk\/?p=342","title":{"rendered":"AutoIT program to screen capture via command line"},"content":{"rendered":"\n<pre class=\"wp-block-code has-small-font-size\"><code>#Region ; Make 64Bit EXE\r\n#AutoIt3Wrapper_UseX64=y\r\n#EndRegion\r\n;screencapture library\r\n#include &lt;ScreenCapture.au3>\r\n;dos mode on\r\n#pragma compile(Console, True)\r\n\r\n\r\n\r\nConsoleWrite(@CRLF &amp; 'Screen capture tool written by Juan Calderon v.1.1 x64 24.04.22' &amp; @CRLF)\r\nConsoleWrite('Distributed as is, free to use for commercial and non-commercial use. ')\r\nConsoleWrite('Source: https:\/\/xuan.guru\/?p=342' &amp; @CRLF &amp; @CRLF)\r\n\r\nSleep (500)\r\n\r\n; call the capture routine\r\nSmile()\r\n\r\nFunc Smile()\r\n\r\n\t\t;command line parameter\r\n\t\tLocal $tell_me_where_save_it, $rezX , $rezY, $rezX1 , $rezY2\r\n\r\n\r\n\t\t; if I have one parameter then lets take the screenshot\r\n\t\tif $cmdline&#91;0]=5 Then\r\n\r\n\t\t\t;grab the one parameter, the path\/filename\r\n\t\t\t$tell_me_where_to_save_it=$cmdLine&#91;1]\r\n\t\t\t;grab coordinates data\r\n\t\t\t$rezX = $cmdLine&#91;2]\r\n\t\t\t$rezY = $cmdLine&#91;3]\r\n\t\t\t$rezX1 = $cmdLine&#91;4]\r\n\t\t\t$rezY1 = $cmdLine&#91;5]\r\n\r\n\r\n\t\t\t_ScreenCapture_Capture($tell_me_where_to_save_it,$rezX,$rezY,$rezX1,$rezY1)\r\n\t\t\tConsoleWrite('Screen capture taken, saved to file ' &amp; $tell_me_where_to_save_it &amp; '.' &amp; @CRLF)\r\n\r\n\t\t\t;If you dont hear a beep then something went wrong\r\n\t\t\tif @error Then\r\n\t\t\tElse\r\n\t\t\t\tBeep(500, 650)\r\n\t\t\tEndIf\r\n\r\n\t\t;So you didn't give me 5 parameters or too many\r\n\t\tElse\r\n\t\t\t; quick help comment.\r\n\t\t\tConsoleWrite('Usage: cap filename.jpg coord_start_X coord_start_Y coord_end_X coord_start_Y' &amp; @CRLF &amp; @CRLF)\r\n\t\t\tConsoleWrite('cap myscreen.jpg 0 0 1280 1080                   - capture main screen 1080p' &amp; @CRLF &amp; 'cap d:\\save_here\\myscreen.jpg -1280 0 0 -1080    - capture secondary screen to the left' &amp; @CRLF)\r\n\t\tEndIf\r\n\r\nEndFunc   ;Done<\/code><\/pre>\n\n\n\n<p><a href=\"https:\/\/xuan.guru\/wp-content\/uploads\/2022\/03\/cap.exe\">download windows binary x64<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/xuan.guru\/wp-content\/uploads\/2022\/03\/cap.au3\">download source code<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/www.autoitscript.com\/site\/autoit\/\">autoIT website<\/a><\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code><strong>ChangeLog<\/strong>\n\n<strong>V1.1<\/strong> 24.04.22\n- 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.\n- Audio alert, a beep sound is make if no errors took place, if you dont hear anything then something went wrong saving the file.\n\n<strong>V1<\/strong> 23.03.22\n- 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.\n\n\n<strong>Known bugs<\/strong>\n-Using display docks confuse the program, its likely I will never resolve this. <\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>download windows binary x64 download source code autoIT website<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[75,71],"class_list":["post-342","post","type-post","status-publish","format-standard","hentry","category-tech-tips","tag-autoit","tag-screen-capture"],"_links":{"self":[{"href":"https:\/\/xuan.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/342","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xuan.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xuan.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xuan.co.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xuan.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=342"}],"version-history":[{"count":21,"href":"https:\/\/xuan.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/342\/revisions"}],"predecessor-version":[{"id":386,"href":"https:\/\/xuan.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/342\/revisions\/386"}],"wp:attachment":[{"href":"https:\/\/xuan.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=342"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xuan.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=342"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xuan.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=342"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}