OLE Automation of OmniPage 12: Newbie Qs

Discussion in 'Perl Misc' started by Veli-Pekka Tätilä, Jul 31, 2005.

  1. 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

    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ä ()
    Accessibility, game music, synthesizers and programming:
    Veli-Pekka Tätilä, Jul 31, 2005
    1. Advertisements

  2. Sisyphus

    Sisyphus Guest

    "Veli-Pekka Tätilä" <> wrote in message
    > 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

    Sisyphus, Jul 31, 2005
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Greg Howard
    Matt Garrish
    Jul 2, 2004
  2. Kosic

    OLE Automation by Javascript

    Kosic, Oct 31, 2003, in forum: ASP .Net
    Tim Burda
    Nov 21, 2003
  3. Patrick.O.Ige

    Ole ole

    Patrick.O.Ige, Jul 16, 2006, in forum: ASP .Net
    Jul 16, 2006
  4. Drew Pihera
    Drew Pihera
    Feb 4, 2004
  5. Lance Hoffmeyer
    Lance Hoffmeyer
    Nov 17, 2003