Solved

Using command lines to operate OCR software through VB6

Posted on 2003-11-26
4
976 Views
Last Modified: 2008-02-26
Hi

I'm having real difficulty with using command lines to control a OCR program through Visual Basic 6.

Basically I have command lines to control a OCR program called SimpleOCR, and honestly I have no Idea how!!

So far I've tried running through DOS with very little luck.
Is there an easier way to use these command lines to access my OCR software.

Thanking in advance
0
Comment
Question by:Reachtabhair
  • 2
  • 2
4 Comments
 
LVL 10

Expert Comment

by:ADSaunders
ID: 9825046
Hi Reachtabhair,
Dim RetVal
RetVal = Shell("pathtocommandlinecommand.EXE", 1)   ' Run command.

However, this will start the command, but not wait for it to finish.

For more subtle control, you'll have to look into the ShellExecute or ShellExecuteEX API.

Regards .. Alan
0
 

Author Comment

by:Reachtabhair
ID: 9831316
Hi alan
thanks for the reply

This is what i've done so far, the problem is that I keep getting a error called 'File Creation Error' on the DOS screen.

If you could have a look at the code and give me your opnion it would be greatly appreciated....


Private Sub Command1_Click()
    Open "C:\commandline.bat" For Output As #1
    Print #1, "Cd .."
    Print #1, "Cd .."
    Print #1, "Cd .."
    Print #1, "Cd .."
    Print #1, "cd progra~1"
    Print #1, "cd Simple~1"
    Print #1, "cd bin"
    Print #1, "simpleocrcmd"
    Print #1, "SimpleOCRCmd [/NONE] <C:\images\Test.tif> <C:\text\line.txt>"
    Close #1
   
    Shell ("C:\commandline.bat"), vbNormalFocus
End Sub


0
 
LVL 10

Accepted Solution

by:
ADSaunders earned 125 total points
ID: 9831394
Hi,
If this text is verbatim, then your problems are with the '<' and '>'  characters on the command line. Dos and up uses these as redirection commands viz a < b    means 'run a taking it's input from b, and a > c means run a sending output to c
so the file creation error is probably fom the '.tif> <C' in the command line or the > at the end.
In any case, is it really necessary to create a batch file, I would have thought that:

Shell ("\progra~1\Simple~1\bin\SimpleOCRCmd /NONE C:\images\Test.tif C:\text\line.txt",vbNormalFocus)

Would have done

.. Alan
0
 

Author Comment

by:Reachtabhair
ID: 9832448
Thanks a milion Alan

Gary
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Excel object stays open 19 78
Excel VBA combine two working workbooks 8 60
Windows Script Host failed (Access is denied.) error 6 214
Excel - Save a copy of work book 13 88
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question