Nomad Posted June 27, 2006 Share Posted June 27, 2006 This is a little script I use fairly often that I thought I might share. I'm sure some of you already have something similar to this, but for those who don't...expandcollapse popup;====================================================================== ; AutoIt Version: 3.1.1 ; Language: English ; Platform: Win9x/NT or newer ; Author: Nomad ; Requirements: ; Captdll.dll - written by Lazycat. ; This script will run on any version of windows. ;====================================================================== ; Script Function: ; Captures a perfectly cut screenshot of the active window ; when {PRINTSCREEN} is pressed. Each filename has a number ; at the end which increases by 1 after each screenshot. ; This allows the user to take multiple shots in sequence ; without having to enter a new filename each time. ;====================================================================== ; Credits: ; Lazycat: ; The .dll required was written by Lazycat. This script is ; fairly simple, he's the one who really did all the work. ; I just use this a lot for taking pics of my GUI windows ; for posting on the web, and thought maybe someone else ; would find it useful. ;====================================================================== Global $Window Global $Count = 1 Global $FileName = InputBox("Input Filename","Input the Filename to save the image(s) as:",""," ", 230, 100, -1, -1) Select Case @Error = 0 HotKeySet("{ESC}", "Terminate") HotKeySet("{PRINTSCREEN}", "Print_Window") Case @Error = 1 Exit Case @Error = 3 MsgBox(4096, "ERROR", "The Input Box failed to open") Exit EndSelect While (1) $Window = WinGetTitle("") Sleep(250) WEnd Func Print_Window () Local $Size = WinGetPos($Window) DllCall("captdll.dll", "int", "CaptureRegion", "str", $FileName & $Count & ".bmp", "int", $Size[0], "int", $Size[1], "int", $Size[2], "int", $Size[3], "int", -1) $Count += 1 EndFunc Func Terminate () Exit EndFuncYou will need Captdll.dll, located here (get the newest version). It was written by Lazycat. This script is just one of many ways to use his concept. If you find this script useful, great. If not, I wasn't expecting the world for it anyway. I have a lot of little scraps I find I'm using quite often, some of which were based on others work, some I completely designed myself. I think I will start posting them here after I revise them a little to make them more user friendly. Nomad Link to comment Share on other sites More sharing options...
NELyon Posted June 27, 2006 Share Posted June 27, 2006 Very useful when you are taking screenshots of programs! Link to comment Share on other sites More sharing options...
ScienceofSpock Posted January 4, 2016 Share Posted January 4, 2016 I know this was posted a LONG time ago, but I'm trying to modify this script for my own purposes, but before I do that, I need to get it working. I have captdll.dll downloaded, but no instructions were provided on where to place captdll.dll, so I placed it in the main AutoIt3 folder. Running the script prompts me for a base image name, but pressing printscr either doesn't save anything, or it's saving them to some non-obvious location. I'm on Win7 x64, and I'm running AutoIt3 in x64 mode.I also tried registering captdll.dll but got an error to the effect of "no entry point found".What am I doing wrong? Link to comment Share on other sites More sharing options...
argumentum Posted January 4, 2016 Share Posted January 4, 2016 (edited) I know this was posted a LONG time ago, but I'm trying to modify this script for my own purposes, but before I do that, I need to get it working. I have captdll.dll downloaded, but no instructions were provided on where to place captdll.dll, so I placed it in the main AutoIt3 folder. Running the script prompts me for a base image name, but pressing printscr either doesn't save anything, or it's saving them to some non-obvious location. I'm on Win7 x64, and I'm running AutoIt3 in x64 mode.I also tried registering captdll.dll but got an error to the effect of "no entry point found".What am I doing wrong?no clue of what you do wrong BUT here is a working one:#include <ScreenCapture.au3> Global $Count = 1 Global $FileName = InputBox("Input Filename", "Input the Filename to save the image(s) as:", "", " ", 230, 100, -1, -1) Select Case @error = 0 If Not HotKeySet("{ESC}", "Terminate") Then ConsoleWrite("--- > no ESC is running" & @CRLF) If Not HotKeySet("{PRINTSCREEN}", "Print_Window") Then ConsoleWrite("--- > no PRINTSCREEN is running" & @CRLF) Case @error = 1 Exit Case @error = 3 MsgBox(4096, "ERROR", "The Input Box failed to open") Exit EndSelect While (1) ;~ $Window = WinGetTitle("") Sleep(250) WEnd Func Print_Window() Local $Window = WinGetTitle("[active]") Local $Size = WinGetPos($Window) ;DllCall("captdll.dll", "int", "CaptureRegion", "str", $FileName & $Count & ".bmp", "int", $Size[0], "int", $Size[1], "int", $Size[2], "int", $Size[3], "int", -1) _ScreenCapture_Capture($FileName & $Count & ".bmp", $Size[0], $Size[1], $Size[0] + $Size[2], $Size[1] + $Size[3], True) If @error Then Return ConsoleWrite("--- > _ScreenCapture_Capture FAILED" & @CRLF) ConsoleWrite("--- > file is at """ & $FileName & $Count & ".bmp" & """" & @CRLF) ShellExecute($FileName & $Count & ".bmp") $Count += 1 EndFunc ;==>Print_Window Func Terminate() Exit EndFunc ;==>Terminateso, Welcome to the forums and have fun learning Edited January 4, 2016 by argumentum joseLB 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
ScienceofSpock Posted January 4, 2016 Share Posted January 4, 2016 Hi Argumentum, and thanks for the help! Your script worked like a charm. I'm guessing that Captdll.dll is deprecated then? Link to comment Share on other sites More sharing options...
argumentum Posted January 5, 2016 Share Posted January 5, 2016 yes @ScienceofSpock , that was for version version 3.1 back on 2006, we are now in 2016 with version 3.3. No big deal, I've asked similar questions in the past.There are scripts shared here in the forums that are quite, let's say, magnificent !, for screen cap.. Look around, it's worth it. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now