Solved

Using command lines to operate OCR software through VB6

Posted on 2003-11-26
4
979 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: 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

Suggested Solutions

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

734 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