Recently Browsing 0 members
No registered users viewing this page.
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 :
DLLCalls using VBScripts
Out if the box it is not possible to do DllCalls from VBScripts. But thanks to the +20 year COM Library called DynaWrap this is still possible
Anyhow the process of calling Win API functions need some basic knowledge and understanding on how to do this.
More specifically the input Data Types parameters used and Calling Formats are key here, as well as the Return Data Types
DynaWrap COM Library
Keep in mind that this COM Library is a 32Bit only library. Which means that you need to register is using the SysWOW64 regsvr32
But to overcome this annoyance I created RegFree method so you can start using it as a portable COM Library
I created a PDF documention on what I still could find on the internet on how to use the COM Library.
The second post will hold some VBScript Examples and an AutoIt Example
You will find the PDF and the ZIP File needed to run your code in a portable way.
Thanks to the @Professor_Bernd to provide the VBScript code to get the VBScript scripting directory and the Shortcut to run the 32Bit SysWOW64 VBScript host
Just drop the VBScript on the 32Bit Shortcut to get going.
Anyhow here you can find the source code of the DynaWrap 32Bit Library.
If someone has the C++ Tools to convert it to 64Bit Library that would give a new live to it...
Interesting reading :
DynaCall.zip How to use DllCalls in VBScript using DynaWrap COM Object.pdf
here is an example about how to split your texts using a delimiter with the ability to select how much of delimiters shows in each colum with $i_number
you have a long text and you want to split it in an array
that evry colum have a number (n) of lines
i made a function that do that for you
just call it with a three params
the number that you want to put in each col
default is "|"
here is the function with example
i hope that it will be useful for you
#include <Array.au3> $s_txt = "some text1some text2|some text3|some text4|some text5|some text6" $array = splitText($s_txt, 2) _ArrayDisplay($array) Func splitText($s_text, $i_number, $s_siparator = "|") Local $a_TXT = StringSplit($s_text, $s_siparator) Local $a_Return[$a_TXT + 1] If ($a_TXT <= $i_number) Or ($i_number <= 0) Then ReDim $a_Return $a_Return = 1 $a_Return = $s_text Return $a_Return EndIf Local $i_Processed = 1, $i_arrayProcessed = 1 Do For $i = $i_Processed To ($i_Processed + $i_number) - 1 If ($a_TXT < $i) Then ExitLoop If Not ($a_Return[$i_arrayProcessed]) Then $a_Return[$i_arrayProcessed] = $a_TXT[$i] Else $a_Return[$i_arrayProcessed] &= $s_siparator & $a_TXT[$i] EndIf $i_Processed += 1 Next $i_arrayProcessed += 1 Until ($a_TXT < $i_Processed) ReDim $a_Return[$i_arrayProcessed] $a_Return = $i_arrayProcessed - 1 Return $a_Return EndFunc ;==>splitText
accept my greetings
for his notes
hello autoit team
please i've a question for you.
am creating a audio player
and in this audio player i want to show the current trac info
such as the total time and the position ... etc
i know i can show it as label
but the screen reader for the blind read the text every change
because it have a screen scan
what i want is to show this informations but such image or icon
i mean i need to create
GUICtrlCreatepic or GUICtrlCreateicon ....
or some thing as that
and show this informations as image on it
i think that i can do that with the
but i couldn't find the currect way to do it
i tried the _GDIPlus_GraphicsDrawString
but i couldn't know how it work
what i need is a small example that create a GUI
and add a multy line text to it as graphic or image.
so i need a simple way because it will changed every sec
i hope any one can help me to do that
global $GUI = GUICreate("text", 400, 400) global $label = GUICtrlCreateLabel(GetText(), 10, 10, 380, 380) GUISetState() do sleep(100) until GUIGetMSG() = -3 exit func GetText() return StringFormat("file name is test.mp3 \r\n total time is 00:30:00 \r\n position is 00:05:50") endFunc
hello autoit group
please i've a question
i had make a function that put some thing into the clipBoard and paste it
using the send function
when the keyboard is english all things work fine
but when the keyboard is arabic the send command write the ltr v insted of the text in clipboard
i was tryed to use
but the same
please can any one help me