Lazycat Posted February 14, 2005 Author Share Posted February 14, 2005 I found this problem - that appears when region width was not multiple 4. Hopefully fixed this now. First post link was updated. Koda homepage ([s]Outdated Koda homepage[/s]) (Bug Tracker)My Autoit script page ([s]Outdated mirror[/s]) Link to comment Share on other sites More sharing options...
Griff Posted February 14, 2005 Share Posted February 14, 2005 Thanks Lazycat, this was just what I needed to finish a script I was making. You can download that here. Link to comment Share on other sites More sharing options...
Lazycat Posted February 16, 2005 Author Share Posted February 16, 2005 Updated dll with JPEG saving ability. Thanks BasicOs for directing into good code snippet! Source now will be posted separately to my public folder cause big size. Koda homepage ([s]Outdated Koda homepage[/s]) (Bug Tracker)My Autoit script page ([s]Outdated mirror[/s]) Link to comment Share on other sites More sharing options...
BasicOs Posted February 16, 2005 Share Posted February 16, 2005 Thanks for changing, now instead of 2000kb every jpg needs only 70kb, in one hour 1 fps only: 70kb x 3600=252Mb, one day=6Gb, one week=42Gb which is pretty for pc control by screen capture, I will post the easy func in script and scraptsUpdated dll with JPEG saving ability. Thanks BasicOs for directing into good code snippet!Source now will be posted separately to my public folder cause big size.<{POST_SNAPBACK}> Autoit.es - Foro Autoit en Español Word visitors Image Clustrmap image: - Football Spanish team - Spanish team: Casillas, Iniesta, Villa, Xavi, Puyol, Campdevilla, etc..Programando en Autoit+Html - Coding Autoit-Html - Arranca programas desde Internet - Preprocesador de Autoit a http Link to comment Share on other sites More sharing options...
Falling Posted February 17, 2005 Share Posted February 17, 2005 (edited) Hey Lazycat would it be very hard to take a 3rd screenshot also? 1. Fullscreen (alerady done) 2. Zoom of area declared (already done) then 3. Screenshot of only the window that was highlighted. When the call was made? I used the IsPressed function to make it so when i press the print-screen button is pressed it does step 1. and 2. (obviously just your code is run at that point). Would i need to add the code there inside those 2 combos to do a top window screenshot or would it be better to add that into your own code? Also i was thinking maybe you could have some kind of file where you can turn on 1-2 or 3 if it's possible to add. If False don't do that call...etc Prob no reason to make a graphical interface for that since most people prob don't swich up how thye do screenshots very often. Lastly, i was thinking it would be cool if you could use your mouse and drop a box on the screen to define the area of #2. (if 2 == true then checks to see if hardcode == true. If hardcode == true then no need to open window creator tool to define area if == false then let user create window on screen. you could even go deeper into this and let them do multiple screens.) I might try to do some of this stuff myself later tonight once i get home. How complicated is this stuff ? What books should i read? Falling Edited February 17, 2005 by Falling Link to comment Share on other sites More sharing options...
Lazycat Posted February 17, 2005 Author Share Posted February 17, 2005 I'm trying to understand what you want but afraid I'm not surely done with it... What you mean of "highlited window"? Active? If so, it's easily can be done now with only 2 additional lines of Autoit code. Frame for selecting area... Hmm, not sure that goal of dll was interact with user... I thinking before about capture only window by it's handle, but since window not on top, this is not very usefull... What I wanted - capturing overlapped or hidden window. Google give me one shareware prog that can do it, and no any info or code snippets... Koda homepage ([s]Outdated Koda homepage[/s]) (Bug Tracker)My Autoit script page ([s]Outdated mirror[/s]) Link to comment Share on other sites More sharing options...
Josbe Posted February 17, 2005 Share Posted February 17, 2005 ...Source now will be posted separately to my public folder cause big size.<{POST_SNAPBACK}>Where? I can't see. Thanks. :"> Btw: LazyCat, very useful your work, thanks. • AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta Link to comment Share on other sites More sharing options...
Falling Posted February 18, 2005 Share Posted February 18, 2005 I'm trying to understand what you want but afraid I'm not surely done with it... What you mean of "highlited window"? Active? If so, it's easily can be done now with only 2 additional lines of Autoit code.You know like when you press Alt-Print Screen. It only takes a screenshot of the window on top.Frame for selecting area... Hmm, not sure that goal of dll was interact with user...What is the goal of dll?I thinking before about capture only window by it's handle, but since window not on top, this is not very usefull... What I wanted - capturing overlapped or hidden window. Google give me one shareware prog that can do it, and no any info or code snippets...<{POST_SNAPBACK}>I think this is what i was talking about with Alt-Print Screen. But like if you had the choice to do Alt-Print Screen capture that's why you would want to have the IsPressed code also? So like when Print Screen is pressed it will do all the conditions that are setup in your dll that are true (set by user)..Sorta what i mean, though i just made up this with words i think maybe this will convey the message more though? Like i have no idea how you would check the Ini file for the settings, so i just used a shortcut of what i ment not real code.While 1 If _IsPressed('2C') = 1 Then ;If(settings.ini line 1 == true) DllCall("captdll.dll", "int", "CaptureScreen", "str", "dump_full.bmp") ;If(settings.ini line 2 == true) DllCall("captdll.dll", "int", "CaptureRegion", "str", "dump_partial.bmp", "int", 100, "int", 100, "int", 300, "int", 200) ;If(settings.ini line 3 == true) ;DllCall("captdll.dll", "int", "CaptureHighlightedWindow", "str", ; "dump_highlighted.bmp") EndIf Sleep(10) WendThe part about useing a window to select the regions you want to zoom in I did not add here because it would just get too complicated (for me).But overall you would have to check to see if it's user definded first if it was then open a window box that they can drag over a region that region would be the "100, 100, 300, 200...except variables definded by the window box they dragged. Link to comment Share on other sites More sharing options...
Lazycat Posted February 18, 2005 Author Share Posted February 18, 2005 Where? I can't see. Thanks.I'm was a bit bisy, I will put it now.You know like when you press Alt-Print Screen. It only takes a screenshot of the window on top.Here is code that do it:While 1 If _IsPressed('2C') = 1 Then _CaptureActiveWindow() Sleep(10) Wend Func _CaptureActiveWindow() $wlist = WinList() For $i = 1 to $wlist[0][0] If BitAND(WinGetState ($wlist[$i][1]), 8) Then $wRect = WinGetPos($wlist[$i][1]) DllCall("captdll.dll", "int", "CaptureRegion", "str", "capture.bmp", _ "int", $wRect[0], "int", $wRect[1], "int", $wRect[2], _ "int", $wRect[3], "int", -1) Return EndIf Next EndFuncWhat is the goal of dll?Just capturing screen with already given parameters I think this is what i was talking about with Alt-Print Screen. But like if you had the choice to do Alt-Print Screen capture that's why you would want to have the IsPressed code also? So like when Print Screen is pressed it will do all the conditions that are setup in your dll that are true (set by user)..Sorta what i mean, though i just made up this with words i think maybe this will convey the message more though? Like i have no idea how you would check the Ini file for the settings, so i just used a shortcut of what i ment not real code.You want to integrate Alt-PrintScreen into dll? And dll should get settings from ini?!!But why? This will be absolutely no flexible! And I not see any advantages of this method. Get rid few lines of Autoit code?.. Koda homepage ([s]Outdated Koda homepage[/s]) (Bug Tracker)My Autoit script page ([s]Outdated mirror[/s]) Link to comment Share on other sites More sharing options...
Falling Posted February 18, 2005 Share Posted February 18, 2005 (edited) You want to integrate Alt-PrintScreen into dll? And dll should get settings from ini?!!But why? This will be absolutely no flexible! And I not see any advantages of this method. Get rid few lines of Autoit code?..<{POST_SNAPBACK}>Flexiblity would be the INI file you define settings in? I prob don't understand enough though.Turning off differant boolean values in the INI file would give you the exact same flexability as you had before. Except that you could open up more choices for the user?Hence making it more flexable?pressing a key is better then double clicking the autoit file no? Explain my bad logic.Also awsome DLL you made. Is there any good books on how to make DLLs?Reguardless thanks for that nice Active Screen. This code below has 90 percent of what i was saying, sorry if my writing skills are so poor.expandcollapse popup;In this little example pressing n will pop up a message ;pressing Esc will leave. ;bool values $FullScreen = 0 $Capture = 0 $Active = 1 While 1 If _IsPressed('2C') = 1 Then If $FullScreen = 1 Then DllCall("captdll.dll", "int", "CaptureScreen", "str", "dump_full.bmp") If $Capture = 1 Then DllCall("captdll.dll", "int", "CaptureRegion", "str", "dump_partial.bmp", "int", 100, "int", 100, "int", 300, "int", 200) If $Active = 1 Then _CaptureActiveWindow() EndIf Sleep(10) Wend Exit Func _IsPressed($hexKey) ; $hexKey must be the value of one of the keys.nn ; _IsPressed will return 0 if the key is not pressed, 1 if it is. ; $hexKey should entered as a string, don't forget the quotes! ; (yeah, layer. This is for you) Local $aR, $bO $hexKey = '0x' & $hexKey $aR = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey) If Not @error And BitAND($aR[0], 0x8000) = 0x8000 Then $bO = 1 Else $bO = 0 EndIf Return $bO EndFunc ;==>_IsPressed Func _CaptureActiveWindow() $wlist = WinList() For $i = 1 to $wlist[0][0] If BitAND(WinGetState ($wlist[$i][1]), 8) Then $wRect = WinGetPos($wlist[$i][1]) DllCall("captdll.dll", "int", "CaptureRegion", "str", "capture.bmp", _ "int", $wRect[0], "int", $wRect[1], "int", $wRect[2], _ "int", $wRect[3], "int", -1) Return EndIf Next EndFunc #cs 01 Left mouse button 02 Right mouse button;does not works in my system... 04 Middle mouse button (three-button mouse) 05 Windows 2000/XP: X1 mouse button 06 Windows 2000/XP: X2 mouse button 08 BACKSPACE key 09 TAB key 0C CLEAR key 0D ENTER key 10 SHIFT key 11 CTRL key 12 ALT key 13 PAUSE key 14 CAPS LOCK key 1B ESC key 20 SPACEBAR 21 PAGE UP key 22 PAGE DOWN key 23 END key 24 HOME key 25 LEFT ARROW key 26 UP ARROW key 27 RIGHT ARROW key 28 DOWN ARROW key 29 SELECT key 2A PRINT key 2B EXECUTE key 2C PRINT SCREEN key 2D INS key 2E DEL key 30 0 key 31 1 key 32 2 key 33 3 key 34 4 key 35 5 key 36 6 key 37 7 key 38 8 key 39 9 key 41 A key 42 B key 43 C key 44 D key 45 E key 46 F key 47 G key 48 H key 49 I key 4A J key 4B K key 4C L key 4D M key 4E N key 4F O key 50 P key 51 Q key 52 R key 53 S key 54 T key 55 U key 56 V key 57 W key 58 X key 59 Y key 5A Z key 5B Left Windows key 5C Right Windows key 60 Numeric keypad 0 key 61 Numeric keypad 1 key 62 Numeric keypad 2 key 63 Numeric keypad 3 key 64 Numeric keypad 4 key 65 Numeric keypad 5 key 66 Numeric keypad 6 key 67 Numeric keypad 7 key 68 Numeric keypad 8 key 69 Numeric keypad 9 key 6A Multiply key 6B Add key 6C Separator key 6D Subtract key 6E Decimal key 6F Divide key 70 F1 key 71 F2 key 72 F3 key 73 F4 key 74 F5 key 75 F6 key 76 F7 key 77 F8 key 78 F9 key 79 F10 key 7A F11 key 7B F12 key 7C-7F F13 key - F16 key 80H-87H F17 key - F24 key 90 NUM LOCK key 91 SCROLL LOCK key A0 Left SHIFT key A1 Right SHIFT key A2 Left CONTROL key A3 Right CONTROL key A4 Left MENU key A5 Right MENU key #ceThe only thing left would be to be able to define the cordinates of the Zoom in real time useing a dragable window. Instead of hand codeing them.Which would just be another bool if tree then open window at start before any code is executed. Edited February 18, 2005 by Falling Link to comment Share on other sites More sharing options...
Falling Posted February 18, 2005 Share Posted February 18, 2005 Hey also can you explain how this works? If BitAND(WinGetState ($wlist[$i][1]), 8) I looked up all the functions in the help file. I kind of get it. 8== active window? Not sure how BitAND works though. Thanks for any info. Link to comment Share on other sites More sharing options...
Lazycat Posted February 18, 2005 Author Share Posted February 18, 2005 Flexiblity would be the INI file you define settings in? I prob don't understand enough though. Turning off differant boolean values in the INI file would give you the exact same flexability as you had before. Except that you could open up more choices for the user?I'm sorry, but I still not understand advantages of it. Why need to do simple things in so weird way? Anyway, source is open, so you can do it in any way you want Is there any good books on how to make DLLs?Probably, but I'm not used any, only help + google. You just have get few good simple examples.Hey also can you explain how this works?If BitAND(WinGetState ($wlist[$i][1]), 8)I looked up all the functions in the help file. I kind of get it. 8== active window?Not sure how BitAND works though.Thanks for any info.<{POST_SNAPBACK}>For example here. Four link at google search... Koda homepage ([s]Outdated Koda homepage[/s]) (Bug Tracker)My Autoit script page ([s]Outdated mirror[/s]) Link to comment Share on other sites More sharing options...
asik Posted March 3, 2005 Share Posted March 3, 2005 This is exactly what I came on here looking for (region screenshots). Going to use this with an external OCR program to determine text in flash and java applets Thanks a lot! Link to comment Share on other sites More sharing options...
Devion Posted April 19, 2005 Share Posted April 19, 2005 Really nice dll, thanks By the way, whats the max quality? Because even if i set it to 100 its sometimes a little blury around text. Anyway, good work! Link to comment Share on other sites More sharing options...
doomsday_jesus Posted February 4, 2006 Share Posted February 4, 2006 Hey Lazycat! This is awesome! Thanks for your contribution! Was wondering... Is it possible to change the color depth of the screenshots captured with your DLL? Would like to capture in monochrome to reduce file size. Again, great work man! Link to comment Share on other sites More sharing options...
Laetterman Posted April 26, 2006 Share Posted April 26, 2006 I have the same question! Is it possible to change the image to an grayscale-image? Using third party progs is a bit slow. bye, Laetterman Link to comment Share on other sites More sharing options...
jacksont123 Posted May 9, 2006 Share Posted May 9, 2006 is it possible to have a screen captures that save to files such as 'Picture001.jpg', 'Picture002.jpg', 'Picture003.jpg', etc. instead of saving it and overwriting the file? Link to comment Share on other sites More sharing options...
jackyyll Posted May 10, 2006 Share Posted May 10, 2006 try using date macros with a file prefix .. that should work just do like... prefix-mmddyy-minminsss Link to comment Share on other sites More sharing options...
jacksont123 Posted May 10, 2006 Share Posted May 10, 2006 (edited) is it possible to have a screen captures that save to files such as 'Picture001.jpg', 'Picture002.jpg', 'Picture003.jpg', etc. instead of saving it and overwriting the file? what if you had this: DllCall("captdll.dll", "int", "CaptureScreen", "str", @ScriptDir & "/Picture.jpg", "int", 40) --i'm not completely sure about the accuracy of this code, but i hope you get what i mean-- and replaced it with DllCall("captdll.dll", "int", "CaptureScreen", "str", @ScriptDir & $pic, "int", 40) where $pic would mean: $pic = "/Picture.jpg" and you would have: If FileExists($pic) Then [script to change the filename to something else so it doesn't overwrite like 'Picture001.jpg'] EndIf Edited May 10, 2006 by The Great 'Awesoma-Powa!' Link to comment Share on other sites More sharing options...
jacksont123 Posted May 10, 2006 Share Posted May 10, 2006 try using date macros with a file prefix .. that should work just do like... prefix-mmddyy-minminssshow would i do that? 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