Hi,
This is my first post here. I tried a couple of newsgroups initially but was
directed here in stead. I've also got questions about the use of the
Clipboard and SAPI4 modules but they'll have to wait for another mail.
Anyway, let's get to the gist of the problem:
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 such as create a
document. I found some sample VB code by Googling the news and based on that
tried the following Perl code:
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 prototype for the login function:
[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
named
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 very little 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.
With kind regards Veli-Pekka Tätilä ([EMAIL PROTECTED])
Accessibility, game music, synthesizers and programming:
http://www.student.oulu.fi/~vtatila/
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs