WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

OLE COM ADO CDO ADSI LDAP
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Textract Problem


Question:

I have a script that starts to process and then I receive a message that

WINBATCH.EXE HAS GENERATED ERRORS AND WILL BE CLOSED BY WINDOWS. AN ERROR LOG IS BEING CREATED.

I do not know where to look for the error log.

I have been experiencing problems running this script since yesterday. I honestly think that I hosed something up when I manually terminated the script.

The script is using TEXTRACT to screen scrape from a window driven by Java. I am using ObjectOpen to open TEXTRACT. The script was at the point of doing a screen scrape using a loop. I realized that I had something incorrect and that I would not exit the loop,so I manually terminated the script. There has been funky stuff happening since then.

Any guidance would be appreciated. Thanks.

Answer:

First try rebooting the system. If that doesn't help then we need to determine exactly where in the script it is crashing. Add DebugTrace to the beginning of the script and run it until it crashes. The last line written to the trace file was the last sucessfully executed line. This means the next line in the script is the line that casused the script to crash. What is that line?

User Reply:

The DebugTrace file indicates that the script seems to be crashing on the line:
rc = Txtr.ReadScreen(200,600,750,750)

Answer:

This maybe due to a problem with Textract OLE Object. Textract support:support@structurise.com.

Althought I tested the following code on my XP system and was unable to get it to GPF (Crash).


BoxOpen("ReadSCreen - Hold Shift Key Down to Exit Script","")
Txtr = ObjectOpen("TxtrCtl.TxtrCtl")
rc = Txtr.Init
While @True
   if iskeydown(@Shift)
	   ObjectClose(Txtr)
		exit
	endif
	rc = Txtr.ReadScreen(0,0,750,750)
	scrnprnt = Txtr.Text
	BoxText(scrnprnt)
	Timedelay(0.5)
EndWhile
ObjectClose(Txtr)

What happens if you run the attached code?

User Reply:

That script worked ok! So I do believe that the problem is with Textract. I have sent an email to the support site..... I do believe that I have resolved the issue of the WINBATCH failure.

Simply, I made several programming errors.

    I did a test where:
  1. I had Notepad open with some lines displayed that did not change.

  2. Created a script to perform a loop about 20 times to screen scrape using TEXTRACT from that Notepad display.

  3. I used the READSCREEN command from TEXTRACT and dumped the results to a variable.
After looping about 10 times, WINBATCH failed. When I checked the log from the debugtrace, I noticed that after several passes through the loop, the results from READSCREEN command were changing. Eventually, it became an unprintable character.

What I think happened is that I used up some type of memory. So I went back to the documentation for TEXTRACT and noticed that there is a TERM command that frees up resources.

I modified my test by doing the following each time that I executed the loop:

ObjectOpen for Textract
The Textract INIT command
The Textract READSCREEN command
The Textract TERM command
ObjectClose for Textract
The test ran no problems. So I modified the original script that I was having a problem with and made the following changes:
  1. Use a counter to control the maximum number of types that a loop can execute to avoid an infinite loop incase of an error on my part.

  2. Added the ObjectOpen, INIT, TERM and ObjectClose each time that I invoke TEXTRACT.
This has worked well for me.
  1. In TEXTRACT there is the TERM command that frees up resources

Article ID:   W16074
File Created: 2004:03:30:15:42:44
Last Updated: 2004:03:30:15:42:44