Author Topic: connection Perl to automtaion interace  (Read 3962 times)

xkrystof

  • EA User
  • **
  • Posts: 29
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
connection Perl to automtaion interace
« on: February 06, 2008, 02:22:57 am »
Hi, could you advise me, how to connect Perl to the EA automation interface?

thank you

Jan

thomaskilian

  • Guest
Re: connection Perl to automtaion interace
« Reply #1 on: February 06, 2008, 02:37:04 am »
I posted something on the EAUG (not the Wiki) some very long time ago.

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: connection Perl to automtaion interace
« Reply #2 on: February 06, 2008, 03:44:58 am »
EA is a COM server, so with luck you can use the appropriate Perl library.

Thomas can confirm whether I'm off on a tangent here.

Of course, the actual details are left to the reader as an exercise...

David
No, you can't have it!

thomaskilian

  • Guest
Re: connection Perl to automtaion interace
« Reply #3 on: February 06, 2008, 04:18:21 am »
Actually it's very easy (if you know how). It should be still in the EAUG... Maybe if someone could maintain what I did, publish the stuff and write a few comment lines I'd be willing to post it again.

gpc

  • EA User
  • **
  • Posts: 111
  • Karma: +0/-0
    • View Profile
Re: connection Perl to automtaion interace
« Reply #4 on: February 06, 2008, 07:29:42 am »
Hi,
Here's a snippet from something I downloaded (and modified) a while ago (attributed to a Dr. UV Wildner). It should give you a basic idea of how to access the interface.

Quote
#!/cygwin/bin/perl -W

use strict;
use Win32::OLE;

sub dumpPackages
{
  my ($pkgCollection) = @_;
  for (my $j=0;$j < $pkgCollection->Count;$j++)
  {
    my $package = $pkgCollection->GetAt($j);

    print $package->Name. " \n";

    # recurse children
    &dumpPackages($package->Packages);
  }
}

my $repository = Win32::OLE->new('EA.Repository', \&OleQuit) or die "oops cannot access Repository interface\n";
my $result = $repository->OpenFile($model);
print "file opened\n" if $result;
die $repository->GetLastError ()."\n" unless $result;
 
my $allModels = $repository->Models();
die "no models found in $model\n" unless ($allModels);
print "found " , $allModels->Count, " models in file\n";
 
for (my $i=0;$i < $allModels->Count;$i++)
{
  my $model = $allModels->GetAt($i);
  print "model ==> ", $model->Name, "\n";
  &dumpPackages($model->Packages);
}

you'll need to set the $model variable to your file name and location. HTH. (maybe someone has the full code or better examples?)

xkrystof

  • EA User
  • **
  • Posts: 29
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: connection Perl to automtaion interace
« Reply #5 on: February 13, 2008, 05:06:14 am »
thanks a lot !!
it looks working :D