in reply to Re: Re: using Word dictionary in Perl
in thread using Word dictionary in Perl

Your'e just (1) from correct. :)
#!/usr/bin/perl -w # Uses use strict; use Win32::OLE; use Win32::OLE::Const; # Create MSWord object and load constants my $MSWord = Win32::OLE->new('Word.Application', 'Quit') or die "Could not load MS Word\n"; my $wd=Win32::OLE::Const->Load($MSWord); # Word and language to search for my $word="big"; my $language=$wd->{wdEnglishUS}; # Get synonyms from MSWord my $synonyms=$MSWord->SynonymInfo( {Word => $word, LanguageID => $language})->SynonymList(1); # Print them out... foreach (@{ $synonyms }) { print $_."\n" };
The (1) returns the synonymlist for the first meaning of the word. If you have a word that can mean many things, you could end up with many synonymlists. You'll then have to check the MeaningCount property and loop all the synonymlists for each meaning.

/brother t0mas

Replies are listed 'Best First'.
Re: Re: Re: Re: using Word dictionary in Perl
by Anonymous Monk on Dec 14, 2000 at 06:36 UTC
    Hi, I could run this program on my PC installed with WIN 98 os(With Active Perl). But the same not working on WIN NT. I am using Indigo PERL on WIN NT. The error is
    Win32::OLE::Const->Load: No or invalid type library name at test.pl li +ne #some no# Win32::OLE(0.13): GetOleTypeLibObject() Not a Win32::OLETypeLib object + at e:/perl56i/site/lib/Win32/OLE/Const.pm line 34.
    Is there any problem with library module Const.pm or it does not work on WIN NT. I appreciate your help. I thoughtof cutting and pasting the error. I used perl test.pl > error.txt. But the above error is not copied to error.txt. I also need how to redirect error to a file on Win NT. There are no buttons to cut and paste. I am trying this program at MS Dos command Prompt. Thanks Ashok
      I don't have the Indigo Perl distro on my PC, so I can't try it out for you. The Const->Load command searches through the registry for the type library. The error you get indicates that it can't find the library that it searches for.

      Do you have MS Word installed on the NT box?

      /brother t0mas