Jump to content

numdig

Active Members
  • Posts

    36
  • Joined

  • Last visited

About numdig

  • Birthday 10/04/1979

Profile Information

  • WWW
    http://deskobj.net

Recent Profile Visitors

320 profile views

numdig's Achievements

Seeker

Seeker (1/7)

2

Reputation

  1. Hi, looks interesting, but I don't understand what's the use for it ? Aren't those APIs (eg. GUICreate) already native to AutoIt3, and therefore written in C ?
  2. Hi guys, (@TheDCoder (+ and @TheSaint ?)) Honestly, I think you are overengineering this. I've been on all three #AutoIt (ie. global), ##AutoIt (ie. local Freenode) and ##AutoItScript (idem, local to freenode) for YEARS (since around 2014), and I haven't met a single soul in all this time. Until i logged one more time yesterday... and have met you guys. Obviously with *this* little frequention, setting ownership would have been overkill (what I was to do? kick and ban myself? lol!) and it is still overkill as there probably won't ever be anybody else than THeSait, theDCoder and myself on that channel for then next two years, until one or two more lost souls end up travelling back to the 90s and turn an IRC client on. Now, don't get me wrong : I find the questions you are raising interesting, (I never bothered studying how this works and why is it so important to have that channel "owned" at all). Interesting, yes, but pointless in our case. So this is all more an exercise, a proof of concept, or a "niche" discussion channel, which is already a good thing and should not pretend to be much more. So let's not get too much headaches with it. LOL ! ;D Speak later, P. ------ How to Set up Your Own IRC Channel (on Freenode.Net) -- http://www.wikihow.com/Set-up-Your-Own-IRC-Channel-on-Freenode.Net [REQUIREMENT: TO BE A REGISTERED USER? -- NDLR] 1. Choose a channel name. IRC channel names start with a #, and Freenode's policy dictates that "off topic" channels should start with ##; e.g. ##mychannel. 2. Join the chosen channel. Use the /join ##mychannel command. If the channel was empty, it will be created and you will automatically become a "channel operator" (sometimes "chanop" or "op"). Ops are allowed to manage the channel – for example, to ban abusers. If the network doesn't give you op rights, it means the channel is already registered by somebody else. 3. Register the channel with the ChanServ bot. This makes sure nobody else can take over the channel. /msg ChanServ register ##mychannel
  3. Hi , just an FYI I replaced the declaration to: Func _Base64Encode($s_Input, $b_WordWrap = True, $s_ProgressTitle = '') and deleted: If $b_WordWrap = '' Then $b_WordWrap = True $b_WordWrap was being always TRUE for me, even when I set it to FALSE. I believe this is because "empty string " = FALSE
  4. True enough. But not AutoIT on its own. It's the trio AutoIT + SciTE4AutoIT + AutoITHelp and Exemples and how well they integrate with one another. A great exemple how to design a great programming product. The result and in practice probably one of the flattest learning curve ever. All being fast and light and powerful too. So well done guys. I feel humble, enlightened and inspired. So thanks
  5. . So I guess you haven't come across Robocopy then. Robocopy, the joy light and hapiness of one's life. Robust to network disruptions, mirroring, handles long paths even when ms-dos copy doesn't, patterns, includes/excludes, properties timstamps, FAT disk timestamp precision issues, tee-style logging (to file AND to console), dry run/list-only. All for free originally in the win srv 2008 tools package. After so many years I still keep discovering new uses options and features. (sigh) (love)... I ll still check yours to see if I'm not missing on sth, but I doubt. Take care. P.
  6. Roger that, loud and clear. So the message is really an indication of the error: eg. "(90): FuncDesc" idicates an error with the "Description" section at (or expected at) line 90, and "FuncModif" is about the "Modified" section, etc. OK I think I've got it. Btw, keep the good work. and thanks for everything you've done so far guys. Take care.
  7. HI I tried to use you program on my include file and I get the following error : --------------------------- Error --------------------------- ScreenCaptureBIS.au3 - ###User Defined Function### _ScreenCaptureBIS_CaptureV2 : (37): FuncModify --------------------------- OK --------------------------- The file is tidy and functional.. And I followed that basic tokenization principles... The template generator configuration file seems OK as well. I've even put my include in the standard AUtoIT directory so as not to do anything funky ... So I don't understand the error. #include-once #include <WindowsConstants.au3> #include <WinAPI.au3> #include <ScreenCapture.au3> ; #INDEX# ======================================================================================================================= ; Title .........: ScreenCaptureBIS ; Description ...: ScreenCapture ; Description ...: Tries to fix ScreenCapture's behavior regarding layered windows capture. ; Author(s) .....: Patryk Szczepankiewicz (pszczepa at gmail dot com) ; =============================================================================================================================== ; #CONSTANTS# =================================================================================================================== Global Const $__SCREENCAPTURECONSTANT_DEFAULT_BITBLT_FLAG = BitOR($SRCCOPY, $CAPTUREBLT) ; =============================================================================================================================== ; #CURRENT# ===================================================================================================================== ;_ScreenCaptureBIS_CaptureV2 ;_ScreenCaptureBIS_CaptureWndV2 ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name...........: _ScreenCaptureBIS_CaptureV2 ; Description ...: Captures a region of the screen ; Syntax.........: _ScreenCaptureBIS_CaptureV2([$sFileName = ""[, $iLeft = 0[, $iTop = 0[, $iRight = -1[, $iBottom = -1[, $fCursor = True[, $iBitBltFlag = Default]]]]]]]) ; Parameters ....: $sFileName - Full path and extension of the image file ; $iLeft - X coordinate of the upper left corner of the rectangle ; $iTop - Y coordinate of the upper left corner of the rectangle ; $iRight - X coordinate of the lower right corner of the rectangle. If this is -1, the current screen ; +width will be used. ; $iBottom - Y coordinate of the lower right corner of the rectangle. If this is -1, the current screen ; +height will be used. ; $fCursor - If True the cursor will be captured with the image ; $iBitBltFlag - Flag to pass to the _WinAPI_BitBlt operation (default it BitOR($SRCCOPY, $CAPTUREBLT)) ; Return values .: See remarks ; Author ........: Paul Campbell (PaulIA) ; History .......: OCT 25, 2011 - Added $iBitBltFlag parameter. It uses $CAPTUREBLT by default in order to capture layered windows ; Remarks .......: If FileName is not blank this function will capture the screen and save it to file. If FileName is blank, this ; function will capture the screen and return a HBITMAP handle to the bitmap image. In this case, after you are ; finished with the bitmap you must call _WinAPI_DeleteObject to delete the bitmap handle. ;+ ; Requires GDI+: GDI+ requires a redistributable for applications that ; run on the Microsoft Windows NT 4.0 SP6, Windows 2000, Windows 98, and Windows Me operating systems. ; Related .......: _WinAPI_DeleteObject, _ScreenCapture_SaveImage ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _ScreenCaptureBIS_CaptureV2($sFileName = "", $iLeft = 0, $iTop = 0, $iRight = -1, $iBottom = -1, $fCursor = True, $iBitBltFlag = Default) If $iRight = -1 Then $iRight = _WinAPI_GetSystemMetrics($SM_CXSCREEN) If $iBottom = -1 Then $iBottom = _WinAPI_GetSystemMetrics($SM_CYSCREEN) If $iRight < $iLeft Then Return SetError(-1, 0, 0) If $iBottom < $iTop Then Return SetError(-2, 0, 0) If $iBitBltFlag = Default Then $iBitBltFlag = $__SCREENCAPTURECONSTANT_DEFAULT_BITBLT_FLAG Local $iW = ($iRight - $iLeft) + 1 Local $iH = ($iBottom - $iTop) + 1 Local $hWnd = _WinAPI_GetDesktopWindow() Local $hDDC = _WinAPI_GetDC($hWnd) Local $hCDC = _WinAPI_CreateCompatibleDC($hDDC) Local $hBMP = _WinAPI_CreateCompatibleBitmap($hDDC, $iW, $iH) _WinAPI_SelectObject($hCDC, $hBMP) _WinAPI_BitBlt($hCDC, 0, 0, $iW, $iH, $hDDC, $iLeft, $iTop, $iBitBltFlag) If $fCursor Then Local $aCursor = _WinAPI_GetCursorInfo() If $aCursor[1] Then Local $hIcon = _WinAPI_CopyIcon($aCursor[2]) Local $aIcon = _WinAPI_GetIconInfo($hIcon) _WinAPI_DeleteObject($aIcon[4]) ; delete bitmap mask return by _WinAPI_GetIconInfo() _WinAPI_DrawIcon($hCDC, $aCursor[3] - $aIcon[2] - $iLeft, $aCursor[4] - $aIcon[3] - $iTop, $hIcon) _WinAPI_DestroyIcon($hIcon) EndIf EndIf _WinAPI_ReleaseDC($hWnd, $hDDC) _WinAPI_DeleteDC($hCDC) If $sFileName = "" Then Return $hBMP _ScreenCapture_SaveImage($sFileName, $hBMP) _WinAPI_DeleteObject($hBMP) EndFunc ;==>_ScreenCaptureBIS_CaptureV2 ; #FUNCTION# ==================================================================================================================== ; Name...........: _ScreenCaptureBIS_CaptureWndV2 ; Description ...: Captures a screen shot of a specified window. This function is an alternative to '_ScreenCapture_CaptureWnd'. ; It is able to take screenshots of layered windows (drawn by the graphic card). See 'remarks' below. ; Syntax.........: _ScreenCaptureBIS_CaptureWndV2($sFileName, $hWnd[, $iLeft = 0[, $iTop = 0[, $iRight = -1[, $iBottom = -1[, $fCursor = True[, $iBitBltFlag = Default]]]]]]) ; Parameters ....: $sFileName - Full path and extension of the image file ; $hWnd - Handle to the window to be captured ; $iLeft - X coordinate of the upper left corner of the client rectangle ; $iTop - Y coordinate of the upper left corner of the client rectangle ; $iRight - X coordinate of the lower right corner of the rectangle ; $iBottom - Y coordinate of the lower right corner of the rectangle ; $fCursor - If True the cursor will be captured with the image ; $iBitBltFlag - Flag to pass to the _WinAPI_BitBlt operation (default it BitOR($SRCCOPY, $CAPTUREBLT)) ; Return values .: See remarks ; Remarks .......: 1/ If FileName is not blank this function will capture the screen and save it to file. If FileName is blank, this ; function will capture the screen and return a HBITMAP handle to the bitmap image. In this case, after you are ; finished with the bitmap you must call _WinAPI_DeleteObject to delete the bitmap handle. All coordinates are in ; client coordinate mode. ; ; 2.1/ Layered windows do not appear on screenshots taken by '_ScreenCapture_Capture' because it uses the desktop's ; handle whereas the layered windows are drawn directly by the graphic card. 2.2/ '_ScreenCapture_CaptureWnd' ; is a wrapper of '_ScreenCapture_Capture' and, therefore, has the same limitations. 2.3/ Instead, ; '_ScreenCapture_CaptureWndV2', THIS FUNCTION, is using the handle of the targetted window to perfom its task ; (in a similar way than '_ScreenCapture_Capture'uses the Desktop's handle). ; ; Author ........: Patryk Szczepankiewicz (pszczepa at gmail dot com) ; History .......: JAN 21, 2009 - Created ; OCT 18, 2010 - First release on the AutoIT forum ; OCT 28, 2010 - Cleaned the border code and fixed the capture of the cursor. ; APR 06, 2011 - Updated for AutoIT 3.3.6.1 ; OCT 25, 2011 - Added $iBitBltFlag parameter. It uses $CAPTUREBLT by default in order to capture layered windows ; Related .......: _WinAPI_DeleteObject ; Link ..........; http://www.autoitscript.com/forum/index.php?showtopic=65008 ; Example .......; No ; Credits .......: Based on Paul Campbell's '_ScreenCapture_Capture' function and inspired by Jennico's '_WinGetBorderSize'. ; =============================================================================================================================== Func _ScreenCaptureBIS_CaptureWndV2($sFileName, $hWnd, $iLeft = 0, $iTop = 0, $iRight = -1, $iBottom = -1, $fCursor = True, $iBitBltFlag = Default) Local $tRect Local $iWndX, $iWndY, $iWndW, $iWndH Local $tClient Local $iBorderV, $iBorderT Local $iPicHeight, $iPicWidth Local $iPicCursorX, $iPicCursorY Local $hDDC, $hCDC, $hBMP, $aCursor, $aIcon, $hIcon ; Default parameters If $iBitBltFlag = Default Then $iBitBltFlag = $__SCREENCAPTURECONSTANT_DEFAULT_BITBLT_FLAG ; Get the absolute coordinates of the window $tRect = _WinAPI_GetWindowRect($hWnd) ; Get useful variables $iWndX = DllStructGetData($tRect, "Left") $iWndY = DllStructGetData($tRect, "Top") $iWndW = DllStructGetData($tRect, "Right") $iWndH = DllStructGetData($tRect, "Bottom") ; Assign automatic values: the right and bottom are computed as ; the width and height of the absolute coordinates of the window. If $iRight = -1 Then $iRight = $iWndW - $iWndX If $iBottom = -1 Then $iBottom = $iWndH - $iWndY ; Check user values: check that caller is not putting the top-left ; corner out of the window. If $iLeft > $iWndW Then $iLeft = $iWndX If $iTop > $iWndH Then $iTop = $iWndY ; Check user values: check that caller is not asking for a ; screenshot bigger than the window itelf. If $iRight > $iWndW Then $iRight = $iWndW If $iBottom > $iWndH Then $iBottom = $iWndH ; Compute the size of the final picture. $iPicWidth = $iRight - $iLeft $iPicHeight = $iBottom - $iTop ; Compute the borders sizes $tClient = _WinAPI_GetClientRect($hWnd) $iBorderV = (($iWndW - $iWndX) - DllStructGetData($tClient, "Right")) / 2 $iBorderT = ($iWndH - $iWndY) - DllStructGetData($tClient, "Bottom") - $iBorderV ; Transfert color data $hDDC = _WinAPI_GetDC($hWnd) $hCDC = _WinAPI_CreateCompatibleDC($hDDC) $hBMP = _WinAPI_CreateCompatibleBitmap($hDDC, $iPicWidth, $iPicHeight) _WinAPI_SelectObject($hCDC, $hBMP) _WinAPI_BitBlt($hCDC, 0, 0, $iPicWidth, $iPicHeight, $hDDC, $iLeft - $iBorderV, $iTop - $iBorderT, $iBitBltFlag) ; Add the cursor on the screenshot If $fCursor Then $aCursor = _WinAPI_GetCursorInfo() If $aCursor[1] Then $hIcon = _WinAPI_CopyIcon($aCursor[2]) $aIcon = _WinAPI_GetIconInfo($hIcon) $iPicCursorX = $aCursor[3] - $aIcon[2] - $iWndX - $iLeft $iPicCursorY = $aCursor[4] - $aIcon[3] - $iWndY - $iTop _WinAPI_DrawIcon($hCDC, $iPicCursorX, $iPicCursorY, $hIcon) EndIf EndIf ; Clean and save data _WinAPI_ReleaseDC($hWnd, $hDDC) _WinAPI_DeleteDC($hCDC) If $sFileName = "" Then Return $hBMP _ScreenCapture_SaveImage($sFileName, $hBMP) EndFunc ;==>_ScreenCaptureBIS_CaptureWndV2
  8. What do you mean by "control instance value", is that the small integer, typically "1", "2", etc. ? And what do you mean by "relative" and "absolute"?! With screenshots, or at least string exemples/samples it would be easier to understand. I've seen a case where an ATL component would have a different CLASSNAME each time it is run, but I don't understand your point regarding the instance number.
  9. Update for _ScreenCapture_CaptureV2 _ScreenCapture_CaptureWndV2 Added optional parameter $iBitBltFlag - Flag to pass to the _WinAPI_BitBlt operation default it BitOR($SRCCOPY, $CAPTUREBLT) instead of $SRCCOPY only Tested with AutoIT 3.3.6.1 ScreenCaptureV2.au3
  10. If you want to check binary content, you'll be better off using something like that: Func CompareFilesBinaryContent($file1, $file2) $resTxt = "" $handle = FileOpen(FileGetShortNameV2($file1), 16) $content1 = FileRead($handle) FileClose($handle) $handle = FileOpen(FileGetShortNameV2($file2), 16) $content2 = FileRead($handle) FileClose($handle) $str_diff = StringCompareExV1($content1, $content2) If $str_diff Then $resTxt = "Files have different binary content." $resTxt &= @CRLF & "File1='" & $file1 & "'" $resTxt &= @CRLF & "File2='" & $file2 & "'" EndIf Return $resTxt EndFunc ;==>CompareFilesBinaryContent As for isolating part of image that are similar from the ones that are different, this is difficult problem. A lot of people are working on it ( inclusing in people in Universities - pattern recognition, image similarities, etc. ), but I haven't stumbled on an easy to use/implement solution yet. Academia is on it. Developers are on it ( eg. http://www.codeproject.com/KB/GDI-plus/comparingimages.aspx ). Let us know if you have more luck. On a more personal note, I started writing a C# application a couple years ago that would group pixels and and search for similarities but interrupted this project because I found an easier way to achieve what I needed: 1/ I compare bare binary content and then 2/ I swap the 2 images every second at the same place and I visually check for differences (works great even for very tiny differences). Take care. -- Edited Tuesday, 4 October 2011, 6:23 PM Note here is another similar work: if you can search for a pixel on the screen, then you can search for a given pixel in another image. The problems are somehow related.
  11. You can't. Please see my comment above to see how to fix _ScreenCapture_Capture and use that instead.
  12. One possible and SIMPLE way to fix this issue is to add the CAPTUREBLT flag to the BitBlt call in the original '_ScreenCapture_Capture' function. _WinAPI_BitBlt( ... , BitOR($SRCCOPY, $CAPTUREBLT)) Created Ticket 1991 to address this issue... consider amending your UDF in the meantime. I will not include this into '_ScreenCapture_CaptureV2' because it is out of scope. The whole point of '_ScreenCapture_CaptureWndV2' is to use the DC of the window itself instead of just being a wrapper for '_ScreenCapture_Capture'. Thanks -- Edited Wednesday, 3 August 2011, 11:40 AM Eventually this could become an additional parameter - that way users could choose whether to have the layered windows visible or not on the screenshots.
  13. OK. So... I checked and I confirm: it doesn't work on your exemple, but it does work on mine. #include <_ScreenCapture_CaptureWndV2.au3> $hWnd = HWnd(0x00460C26) WinActivate($hWnd) WinWaitActive($hWnd) Sleep(500) _ScreenCapture_CaptureWnd($hWnd & "-_ScreenCapture_CaptureWnd.png", $hWnd) _ScreenCapture_CaptureWndV2($hWnd & "-_ScreenCapture_CaptureWndV2.png", $hWnd) => See screenshots in attachment... The styles differences are as follows: BUBBLE CALCULATOR WS_POPUP WS_POPUP WS_VISIBLE WS_VISIBLE WS_CLIPSIBLINGS WS_CLIPSIBLINGS WS_BORDER WS_SYSMENU WS_EX_LEFT WS_EX_LEFT WS_EX_LTRREADING WS_EX_LTRREADING WS_EX_RIGHTSCROLLBAR WS_EX_RIGHTSCROLLBAR WS_EX_TOPMOST WS_EX_TOPMOST WS_EX_TOOLWINDOW WS_EX_LAYERED WS_EX_LAYERED => I tried changing the Calculator application and recompiling it with different settings/styles. So, I replaced $WS_EX_LAYERED by BitOR($WS_EX_LAYERED, $WS_EX_TOOLWINDOW)), without luck. An interesting test would be to remove the WS_BORDER and WS_SYSMENU styles and see if it still doesn't work. Last but not least, we should ask the author of this application whether he is doing anything special that might stop us from taking a screenshot of the window?
  14. In my dream world, the $hWnd parameter would be also optional and would be set by default to to "[ACTIVE]". But you are absolutely right. 'CaptureWnd' is not coherent with 'Capture', and it should...
  15. How did you retrieve your window handle? I'll have a look at those apps you mentionned before. I'll let you know what I find...
×
×
  • Create New...