Jump to content

Patrik96

Members
  • Posts

    6
  • Joined

  • Last visited

Reputation Activity

  1. Like
    Patrik96 reacted to Jos in Screen scraping   
    Maybe the annoying black background you have even when posting? (Maybe next time Past without formatting!   )
  2. Thanks
    Patrik96 reacted to Nine in Screen scraping   
    @Patrik96Here a function that you could try.  If images are not too too big, you should get a decent response time.
    Func ClearAll($nColorPreserved, $nColorClear) Local $iSize = $iGS_Width * $iGS_Height $nColorPreserved = BitOR($nColorPreserved, 0xFF000000) $nColorClear = BitOR($nColorClear, 0xFF000000) For $i = 1 To $iSize If DllStructGetData($tGS_Struct, "color", $i) <> $nColorPreserved Then DllStructSetData($tGS_Struct, "color", $nColorClear, $i) Next EndFunc  
  3. Thanks
    Patrik96 reacted to Danyfirex in UWPOCR - Windows Platform Optical character recognition API Implementation   
    Hello guys.  I recently saw some posts that Windows 10 provides OCR API. So I decided to create a UDF.
     
     
    What's UWPOCR?
    UWPOCR UDF is a simple library to use Universal Windows Platform Optical character recognition API.
    Features.
    Get Text From Image File. Get Text From GDI+ Bitmap. Easy to use.  Usage:
    #include "..\UWPOCR.au3" _Example() Func _Example() Local $sOCRTextResult = _UWPOCR_GetText(FileOpenDialog("Select Image", @ScriptDir & "\", "Images (*.jpg;*.bmp;*.png;*.tif;*.gif)")) MsgBox(0,"",$sOCRTextResult) EndFunc Get Words Rect(Example):

     
    More examples here.
     
    Check UWPOCR UDF on GitHub.
     
    Saludos
  4. Thanks
    Patrik96 reacted to Nine in Screen scraping   
    Screen scraping means a way to read / write on the representation of the current screen.  You can, with this UDF, read the actual foreground of the screen or a background window.  Hidden or minimized window are not supported.  I tried to optimize the use of AutoIt as much as I could, but some actions require the performance of a DLL.
    I have found multiple threads and others UDF discussing this subject but never found an optimized approach to this issue without gathering everything inside a large DLL. 
    The examples I am providing show how to use a background window (even if it is in the foreground when you run it directly with Scite) or use the current screen.  Reading current screen is faster (about 20-30 ms faster) than reading a background window.
    You need to first initialize the structure based on width and height.  You can reuse the structure as long as you want if the dimensions do not change.  You will need to make a new initialize if dimensions are changing.   You do not need (this way) to have the actual size of a window.  You can decide to reduce the dimensions to increase performance.
    Supports x86 and x64.
    The following functions are included in the UDF : 
    _GetScreen_Initialize($iWidth, $iHeight)
    _GetScreen_GetScreen()
    _GetScreen_GetWindow($hWnd, $iFlag = 0)
    _GetScreen_GetPixel($iX, $iY)
    _GetScreen_SetPixel($iX, $iY, $iValue)
    _GetScreen_SearchArea($iLeft, $iTop, $iRight, $iBottom, $iColor, $iStart = 1)
    _GetScreen_SearchAll($iColor, $iStart = 1)
    _GetScreen_PixelReplaceArea($iColorFrom, $iColorTo, $iLeft, $iTop, $iRight, $iBottom)
    _GetScreen_PixelReplaceAll($iColorFrom, $iColorTo)
    _GetScreen_CheckSumArea($iLeft, $iTop, $iRight, $iBottom)
    _GetScreen_SaveFile($sFileName)
    _GetScreen_GetBitMap()
    Version 2022-04-17
    * Added new optional parameter $iFlag to _GetScreen_GetWindow
    0 = full window for Win 7 and over 1 = client area for Win 7 and over 2 = full window for Win 10 and over (this can be used with applications (like Chrome) that do not support  WM_PRINT or WM_PRINTCLIENT messages) Version 2021-11-28
    * Corrected a bug in SearchArea
    Version 2021-08-30
    * Fixed bugs related to areas
    * Added support to repetitive searches in the same area
    * Added a function to make a CheckSum of an area
    * Added an additional example
    Version 2021-08-24
    * Removed unused structure
    * Harmonized code
     
    Example 1 : show various functions using the _GetScreen_GetWindow (background support)
    Example 2 : show new functions using _GetScreen_GetScreen() (foreground only but faster)
     
    All comments are very much welcome.
     
    GetScreen.zip
  5. Like
    Patrik96 reacted to Nine in _WinAPI_GetPixel on a Parent Window   
    You may try this if you are on Win10:
     
    Use option 2 as described in the post.
×
×
  • Create New...