OLE Automation of OmniPage 12: Newbie Qs

  • Thread starter Veli-Pekka Tätilä
  • Start date
V

Veli-Pekka Tätilä

Hi,
This is my first post in this group. Hope it is all right to ask app
specific questions here about OLE, even if Perl is not the culprit. I first
tried the group comp.os.ms-windows.programmer.ole but it is almost dead
compared to this one.

I'm pretty much a newbie as far as OLE and COM goes having only done some
basic automation of SAPI 5 and Auto It from Perl. I own Scansoft
OmniPage 12 and discovered on the Internet that the office version should
support OLE automation. However, I also found out with the help of the
Visual Studio 6 Ole View app that my version 12, which is not the office
edition at all, does seem to have quite a number of methods and properties
that one could use.

Basic methods like AppName and AppInitialized do work. However, I get a
null-reference when trying to do anything useful at all such as create a
document. I found some sample VB code by Googling the news and based on that
tried the following Perl snippet:

use strict;
use OLE;
$/ = "\n";
my $op = CreateObject OLE 'Omnipage12' or die "OLE Error: $!\n";
print "This is " . $op->AppName() . ' v' . $op->Version . "";
my $process = $op->Login('');
warn "App not initialized" unless($op->AppInitialized());
my $result = $process->CreateDocument();
print "Result: $result";

Something definitely does happen when running this. The version and app name
is as expected, the input focus moves temporarily out of the DOS window and
I can hear the hard drive working for a while.

There are two problems, though. Firstly I'm not sure what should be passed
to the login function. No matter what I pass, it never reports that OmniPage
has been initialized succesfully.

The OLE viewre gives the following:

[id(0x00000005), helpstring("Initialize OmniPage for automation")]
IDispatch* Login([in] BSTR Key);

Umm a pointer to the IDispatch interface and a function taking a String name
Key. But what's this bit about the bracketed [in]?

Secondly, perl says that $process has the value undef hinting that something
went wrong early on. I reckon this is a direct consequence of the login
failing but again am not totally sure.

To understand OmniPage OLE automation better I've been trying to find the
official Scansoft docs on it with no luck so far. Neither my version 12
manual nor the version 14 office PDF manual mention OLE automation, oh well.

Has anyone managed to get OmniPage 12 OLE automation working and if so what
am I doing wrong?

Further more, would be great if someone could give a definite answer on
whether OLE Automation is supported in Omni Page version 12 that does not
have the label Office appended to the name. The methods are there as I said
but with my luck they have probably been criplled in some way. If Login
shall always return NULL, for instance, I suppose there's not anything I can
do.

By the way, I'm running Win XP SP2 and Active State Perl 5.8.6 in case that
has any significance.

On a side note, the reason why I'm trying automation in the first place is
that I'd like a quick means of converting a screenshot to speech being sight
impaired. If I could do a little perl script that does the job it might help
a great deal in interpreting textual but image based content quickly without
having to
fall back to full-screen magnification, or manual OCRing for that matter.

Any help greatly appreciated as usual.
 
S

Sisyphus

Veli-Pekka Tätilä said:
Hi,
This is my first post in this group. Hope it is all right to ask app
specific questions here about OLE, even if Perl is not the culprit.

The perl-win32-users mailing hosted by ActiveState is probably a better
forum. (To subscribe, visit http://aspn.activestate.com/ASPN/Mail/ . Mention
"OLE" in the subject line of your post if you send mail there. That will
improve the chances of getting an informed response.)

Beyond that ..... I can't really help - though there may be others here who
can.

Cheers,
Rob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top