Okay - thanks to a couple of suggestions and much reading of books, pods and help files - here is some sample code that works. I'm posting it because I've googled and searched and there doesn't seem to be any sample perl code for geoprocessing dispatch on the entire 'Net. Of course, this is the simplest sample in the book...

use Win32::OLE;
my $Class = "esriGeoprocessing.GpDispatch.1";
my $gp =  Win32::OLE->new($Class)
    || die "Could not create a COM '$Class' object";
my $testtext = $gp->Usage('Buffer_analysis');
print $testtext;


On Nov 5, 2004, at 15:15, Celeste Suliin Burris wrote:

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Celeste Suliin Burris
Sent: Friday, November 05, 2004 3:57 PM
To: [EMAIL PROTECTED]
Subject: Convert Python Com Code to Win32::OLE



I'm a Unix systems administrator who is making the transition to Windows. I am trying to access some COM objects, but the only examples I have are written in Python, using "import win32com.client".

Here's the Python Script (which works). I copied it from the manual,
then tested it.

import win32com.client
gp = win32com.client.Dispatch("esriGeoprocessing.GpDispatch.1")
testtext = gp.Usage("Buffer_analysis")
print testtest

Here's my perl script - which doesn't work.

use Win32::OLE;
# Set some variables
my $Class = "esriGeoprocessing.GpDispatch.1";
my $gp =  Win32::OLE->new($Class)
     || die "Could not create a COM '$Class' object";

$testtext = $gp->{Usage}->("Buffer_analysis");
print $testtest;

There error message I get is "Undefined subroutine &main:: called at
sample.pl line 7.
darned if I can figure out what it should be.

If someone could point out where I've gone wrong, I'd sure appreciate
it.  I'm sure the Win32:OLE module is correctly installed, since the
test scripts work, and so do the ones from the Roth book.

Celeste Suliin Burris
Systems Administrator
Tacoma Economic Development Department
Phone - 253-591-5093
Email - [EMAIL PROTECTED]


_______________________________________________
Perl-Win32-Users mailing list [EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


_______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to