Jump to content
Sign in to follow this  
RomainR

Error message while using many times tesseract function

Recommended Posts

RomainR

Hi all,

I discovered your forum from the french AutoIt community.

First of all I would like to thank all the submitters of this topic http://www.autoitscript.com/forum/index.php?showtopic=92795 for the function "SimpleTesseract.au3" (Tesseract is an open source OCR) which is very usefull for me :)

Here is my problem: I need to use the function simpletesseract several times and on a quite large resolution in the same script. After using it more than 40 times, I get the following error message:

"_WinAPI_CreateCompatibleBitmap : Espace insuffisant pour traiter cette commande"

It is in french but the transalation would be something like:

"_WinAPI_CreateCompatibleBitmap: Insufficient space to treat the command"

There must be some kind of leak in the function. I tried this:

#include <SimpleTesseract.au3> 
$Temp = 1  
While $Temp < 45  
_TesseractScreenCapture(0,"",1,3,0,0,1024,768,0) 
$Temp = $Temp + 1  
WEnd

And I get the same error message...

I'm not an expert and I really don't how I can solve this issue but there must be something to destroy at the end of the function or something like that? Any help appreciated :)

Here is the source of the tesseract function: http://www.autoitscript.com/forum/index.php?app=core&module=attach&section=attach&attach_id=25714

PS: sorry if my english is not that good but it's well known that french are bad at speaking foreign languages!

Share this post


Link to post
Share on other sites
JohnOne

The error seems to indicate that the temp path you set, does not have enough disk space, but I see you set it to cleanup, bit puzzling.

Are you storing the images anywhere as variables, in an array or something ?


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
RomainR

Hi JohnOne and thanks for your reply.

I think the problem does not come from disk space because I've got something like 16Go free space on C: and 35Go on D: so I should be enough... However, I tried to change the temporary path defined in the SimpleTessarct function ($tesseract_temp_path = D:\Temp\ instead of C:\ ) but I still get the same error message.

Are you storing the images anywhere as variables, in an array or something ?

No I don't. As you can see on the simple script in my first post, I do not store the images anywhere. But maybe the tesseract function does it itself? The problem is that I don't understand whole behaviour the function because it is far too complicated according to my knowledges... I guess it may be related to virtual memory or stuff like that.

Any other idea?

Share this post


Link to post
Share on other sites
water

Could you try to insert a Sleep function after every screencapture? I once had a similar problem with Active Directory that was solved this way:

#include <SimpleTesseract.au3> 
$Temp = 1  
While $Temp < 45
  _TesseractScreenCapture(0,"",1,3,0,0,1024,768,0)
  $Temp = $Temp + 1
  Sleep(1000)
WEnd

Another idea: Have you checked that the Variable $Temp isn't used by Tesseract as well?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
RomainR

I tried the script you submitted with a sleeping time of 5 seconds: Sleep(5000) but the issue remains :)

I also checked the Tesseract script and the var $Temp is not used in the function (only $tesseract_temp_path and $temp_path are used).

I performed some tests using "process explorer" and I observed a leak in "GDI objects" while my script was running. I'm almost sure that the problem comes from something (an object, an array or a simple variable maybe) which is not totally destroyed and rebuilt each time the function _TesseractScreenCapture is called. But I can't find out which one...

Share this post


Link to post
Share on other sites
dcat127

I had the same problem, and am posting the solution that I found:

$hBitmap2 is not being released.

I added

_WinAPI_DeleteObject ($hBitmap2)

down at the bottom where the other things are being released. (around line 1000) of tesseract.au3

Share this post


Link to post
Share on other sites
Melba23

dcat127,

I would also post this in the Tesseract thread itself. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
superboss

Perfect. Thanks very much for this post and solution. No idea why this wasnt identified earlier.

The Teeeract.au3 file should be fixed asap.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×