Jump to content

Recommended Posts

Posted

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!

Posted

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?

Posted

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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

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...

  • 2 years later...
Posted

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

  • Moderators
Posted

dcat127,

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

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

  • 2 weeks later...

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...