Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Using command lines to operate OCR software through VB6

Posted on 2003-11-26
4
Medium Priority
?
983 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 500 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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 process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses

926 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