Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/03/2024 in all areas

  1. ioa747

    OCR from a small area

    updated the script above what to watch out for: script run in 32 bit the image should be at 100% size Feel free to ask if you have any questions.
    1 point
  2. ioa747

    OCR from a small area

    I don't know why it won't work for you the only limitation it has is that it has to run in 32 bit otherwise try disabling , in line:10 DllCall("user32.dll", "bool", "SetProcessDpiAwarenessContext", "int", -4) ; -4=PerMonitorAwareV2 and do a test this script is more a fast how-to guide for that and it doesn't have full error handling it seems long and many pieces are copied from other scripts, and a large part they need the patterns which, by the way, it prints on the console, you just copy and paste when you choose the area it is better not to choose a large area but to give a margin of 10 to 20 pixels, the bigger it is the more it delays give me some time and i will integrate the other numbers
    1 point
  3. Purpose (from Microsoft's website) The HTTP Server API enables applications to communicate over HTTP without using Microsoft Internet Information Server (IIS). Applications can register to receive HTTP requests for particular URLs, receive HTTP requests, and send HTTP responses. The HTTP Server API includes SSL support so that applications can exchange data over secure HTTP connections without IIS. Description There have been several times in the past that I wanted to either retrieve information from one of my PCs or execute commands on one of my PCs, whether it was from across the world or sitting on my couch. Since AutoIt is one of my favorite tools for automating just about anything on my PC, I looked for ways to make to make it happen. Setting up a full blown IIS server seemed like overkill so I looked for lighter weight solutions. I thought about creating my own AutoIt UDP or TCP servers but that just wasn't robust enough, Then I found Microsoft's HTTP Server API and it looked very promising. After doing a little research into the APIs, I found that it was flexible & robust enough to handle just about any of the tasks that I required now and in the future. So a while back I decided to wrap the API functionality that I needed into an AutoIt UDF file to allow me to easily create the functionality I needed at the time. It has come in very handy over the years. Of course it wasn't all wrapped up with a nice little bow like it is now. That only happened when I decided to share it with anyone else who could use it or learn from it. The example file that I included is a very granular example of the steps required to get a lightweight HTTP Server up and listening for GET requests. The UDF is a wrapper for the Microsoft APIs. That means to do anything over and above what I show in the example, one would probably have to have at least a general knowledge of APIs or the ability to figure out which APIs/functions to use, what structures and data is needed to be passed to them, and in what order. However, the UDF gives a very solid foundation on which to build upon. Of course, if anyone has questions about the UDF or how to implement any particular functionality, I would probably help to the extent that I could or point you in the right direction so that you can figure out how to implement your own solution. Being that this is basically an AutoIt wrapper for the Microsoft API functions, there's no need to create AutoIt-specific documentation. All of the UDF functions, structures, constants, and enumerations are named after their Microsoft API counterparts. Therefore, you can refer to Microsoft's extensive documentation of their HTTP Server API. The APIs included in the UDF are the only ones that I have needed in the past to do what I needed to do. If you would like any additional APIs to be added to the UDF file, please suggestion them. Related Links Microsoft HTTP Server API - Start Page Microsoft HTTP Server API - API v2 Reference Microsoft HTTP Server API - Programming Model >>> See screen shots and DOWNLOAD in the Files section <<<
    1 point
  4. What's New in Version v1.4.0 v1.4.0 (2023-08-15) Added the ability to set the Content-Type response header's value in _HTTPAPI_HttpSendHttpResponse(). See the function's header and the example script in order to see how to implement the new functionality. Thanks @noellarkin for the suggestion. Added an additional api link (/json) to the example script in order to show the new content-type functionality in _HTTPAPI_HttpSendHttpResponse(). v1.3.0 (2022-06-14) - These modifications were not previously released. Added 2 new internal functions related to setting response headers: __HTTPAPI_ResetKnownResponseHeaderValue() - Clears a known response header __HTTPAPI_SetKnownResponseHeaderValue() - Set a known response header Did a little code optimization/refactoring in _HTTPAPI_HttpSendHttpResponse() and some of the struct definitions.
    1 point
  5. Thank you @noellarkin, I'm glad you've found the UDF useful. I think your suggestion of being able to set the "Content-Type" response header to something other than "text/html" is an excellent one. Although a "Content-Type" of "text/html" would work for JSON and most other content types, I can definitely think of reasons why having that header set to something more specific would be beneficial on the client side. I will implement your feature request of being able to set the "Content-Type" header value in the call to _HTTPAPI_HttpSendHttpResponse(). Since it is now morning where I am, I should be able to post the updated version later today. Thanks
    1 point
  6. Been using this for a personal project, love it:) Just had a suggestion: In the function _HTTPAPI_HttpSendHttpResponse adding an additional parameter $sResponseType Func _HTTPAPI_HttpSendHttpResponse($hRequestQueue, $iRequestId, $iStatusCode, $sReason, $sBody, $sResponseType = "text/html") And replacnig "text/html" in the function with $sResponseType. Allows one to use other formats, like JSON :) For example: Switch $sPath Case $path & "/username" $iStatusCode = 200 $sReason = "OK" $sMsg = '{"username":"' & @UserName & '"}' EndSwitch _HTTPAPI_HttpSendHttpResponse($requestqueue, $tRequest.RequestId, $iStatusCode, $sReason, $sMsg, "application/json")
    1 point
  7. MrKm

    OCRSpace UDF

    AutoIT-OCRSpace-UDF1.3.zip This tiny yet powerful UDF will help you to convert Images to text with the help of OCRSpace API version 3.50 . Detect text from a local file. ; ========================================================= ; Example 2 : Gets text from an image from a local path reference ; : Searchable PDF is not requested by default. ; : Processes it using a basic OCR logic. ; ========================================================= $b_Create_Searchable_PDF = True ; Use a table logic for receipt OCR $b_Table = True ; Set your key here. $v_OCRSpaceAPIKey = "" $OCROptions = _OCRSpace_SetUpOCR($v_OCRSpaceAPIKey, 1, $b_Table, True, "eng", True, Default, Default, $b_Create_Searchable_PDF) $sText_Detected = _OCRSpace_ImageGetText($OCROptions, @scriptdir & "\receipt.jpg", 0, "SEARCHABLE_URL") ConsoleWrite( _ " Detected text : " & $sText_Detected & @CRLF & _ " Error Returned : " & @error & @CRLF & _ " PDF URL : " & Eval("SEARCHABLE_URL") & @CRLF) Detect text from a URL reference. ; ========================================================= ; Example 1 : Gets text from an image using a url reference ; : Searchable PDF is not requested. ; : Processes it using a basic OCR logic. ; ========================================================= $v_OCRSpaceAPIKey = "" ; SetUp some preferences.. $OCROptions = _OCRSpace_SetUpOCR($v_OCRSpaceAPIKey, 1, False, True, "eng", True, Default, Default, False) ; Make the request.. $sText_Detected = _OCRSpace_ImageGetText($OCROptions, "https://i.imgur.com/vbYXwJm.png", 0) ConsoleWrite( _ " Detected text : " & $sText_Detected & @CRLF & _ " Error Returned : " & @error & @CRLF)   Detect text from a URL reference to an array #include "OCRSpaceUDF\_OCRSpace_UDF.au3" #include <array.au3> ; Set your key here. $v_OCRSpaceAPIKey = "" $OCROptions = _OCRSpace_SetUpOCR($v_OCRSpaceAPIKey, 1, $b_Table, True, "eng", True, Default, Default, False) ; Below, the return type is set to 1 to return an array containing the coordinates of the bounding boxes for each word detected, ; in the format : #WordDetected , #Left , #Top , 3Height, #Width $aText_Detected = _OCRSpace_ImageGetText($OCROptions, "https://i.imgur.com/Z1enogD.jpeg", 1) _ArrayDisplay($aText_Detected, "") Download Latest Version : https://github.com/MurageKabui/AutoIT-OCRSpace-UDF
    1 point
  8. Melba23

    OCRSpace UDF

    Hi, Please make sure you read the OCRSpace API link before you get too involved in this UDF. This is NOT a stand-alone OCR solution and requires internet linkage to the host server with various limits on frequency and size for the free subscription. I do not want to put anyone off, but this is not clear from the OP. M23
    1 point
  9. @Danyfirex You are awesome! I kept trying to find the issue last night until I couldn't keep my eyes open any longer and just fell asleep. Then I woke up this morning and saw your post. I felt like a little kid on Christmas morning seeing all the gifts under the tree, I'm going to put your fix in and post a new version now (or as soon as I can get a cup of coffee in me). Your efforts are greatly appreciated!
    1 point
  10. Hello. I checked deeply. The issue in x86 mode is in the $__HTTPAPI_gtagHTTP_DATA_CHUNK_FROM_MEMORY structure. I just patched it with this. (I didn't want to look into that messed union structure🤣) Global $__HTTPAPI_gtagHTTP_DATA_CHUNK_FROM_MEMORY = _ $__HTTPAPI_gtagHTTP_DATA_CHUNK & _ "struct;" & (@AutoItX64 ? "" : "ptr;") & _ "ptr pBuffer;" & _ "ulong pBufferLength;" & _ "endstruct;" It also works running under x86 OS. (Tested in Windows 7x86) Saludos
    1 point
  11. It's a work in progress but it woks 😁 Ever worked with nested arrays before and wanted to see the whole tree structure to examine your array? Now you can! With this handy little UDF: #include <GuiTreeView.au3> #include <GuiConstants.au3> Local $A = [1, 2, 3] Local $B = [['a', 'b', 'c'], ['d', $A, 'f'], ['g', 'h', 'i']] Local $C = [$A, $B] _NestedArrayDisplay($A) _NestedArrayDisplay($B) _NestedArrayDisplay($C) ; #FUNCTION# ==================================================================================================================== ; Name ..........: _NestedArrayDisplay ; Description ...: For viewing nested array's in a treevieuw ; Syntax ........: _NestedArrayDisplay($array) ; Parameters ....: $array (a nested array) ; Return values .: None ; Author ........: TheAutomator ; Modified ......: First UDF, not modified yet ; Remarks .......: Can also display multidimensional array's ; Related .......: _ArrayDisplay ; Link ..........: None ; Example .......: Above this description ; =============================================================================================================================== Func nested($thing, $node) If IsArray($thing) Then Local $inside If UBound($thing, 0) > 1 Then $inside = GUICtrlCreateTreeViewItem('[MULTID. ARRAY]', $node) For $X = 0 To UBound($thing, 1) - 1 For $Y = 0 To UBound($thing, 2) - 1 nested($thing[$X][$Y], $inside) Next Next Else $inside = GUICtrlCreateTreeViewItem('[ARRAY]', $node) For $item In $thing If IsArray($item) Then nested($item, $inside) Else GUICtrlCreateTreeViewItem($item, $inside) EndIf Next EndIf Else GUICtrlCreateTreeViewItem($thing, $node) EndIf EndFunc ;==>nested Func _NestedArrayDisplay($array) Local $temp_gui = GUICreate('Nested Array', 410, 410) Local $treeview = GUICtrlCreateTreeView(5, 5, 400, 400) nested($array, $treeview) GUISetState(@SW_SHOW, $temp_gui) _GUICtrlTreeView_Expand($treeview) While GUIGetMsg() <> $gui_event_close WEnd GUIDelete($temp_gui) EndFunc ;==>_NestedArrayDisplay Enjoy, hope it's useful for you guys! TheAutomator
    1 point
  12. Miloud

    get result of ShellExecute

    The internet said that shellExecute() is suitable than run() when parameters are needed. This doesn't work either: Local $iRc = Run ( '"G:\ffmpeg\bin\ffmpeg.exe" "-version"' , "G:\ffmpeg\bin\") ;Local $iRc = Run ( '"G:\ffmpeg\bin\ffmpeg.exe" -version' , "G:\ffmpeg\bin\") ;Local $iRc = Run ( 'G:\ffmpeg\bin\ffmpeg.exe -version' , "G:\ffmpeg\bin\") ProcessWaitClose($iRc) $Message = StdoutRead($iRc) I need to get output from ffmpeg and determine wether commands finished execution!
    1 point
×
×
  • Create New...