I've recently translated some OLE code from vbs to perl and in most cases it went quite well. The following however I can't get working. vbs-code:
Dim pcbApp
Set pcbApp = GetObject(, "MGCPCB.ExpeditionPCBApplication")
Dim pcbDoc
Set pcbDoc = pcbApp.ActiveDocument
Dim key
key = pcbDoc.Validate(0)
Dim licenseServer
Set licenseServer = CreateObject("MGCPCBAutomationLicensing.Applicatio
+n")
Dim licenseToken
licenseToken = licenseServer.GetToken(key)
msgbox licenseToken
translated like this:
use strict;
use warnings;
use Win32::OLE;
my $pcbApp;
eval {$pcbApp = Win32::OLE->GetActiveObject('MGCPCB.ExpeditionPCBAppli
+cation')};
die "Expedition not installed" if $@;
die "Expedition not running" unless defined $pcbApp;
my $pcbDoc = $pcbApp->ActiveDocument;
die "No active document." unless $pcbDoc;
my $key = $pcbDoc->Validate(0);
my $licenseServer = Win32::OLE->new('MGCPCBAutomationLicensing.Applica
+tion');
die "Automation license acquisition failed: " . Win32::OLE::LastError(
+) unless defined $licenseServer;
The vbs code runs and displays the licenseToken at the end. The perl code fails with
Automation license acquisition failed: Win32::OLE(0.1709) error 0x8007
+007e: "The specified module could not be
found"
Using 'CreateObject' instead of 'new' doen't change anything (from the docs I expect them to be equivalent). Any idea how to track down the source of this error?
Wolfram