Solved

Using command lines to operate OCR software through VB6

Posted on 2003-11-26
4
974 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks a milion Alan

Gary
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now