in reply to Re^2: WIN32::OLE bridging to MATHCAD
in thread WIN32::OLE bridging to MATHCAD

Ok, so what your telling me is that the getvalue method does not work because of something to do with threads.
Thats my guess. You need to examine $^E or Win32::OLE->LastError() for a better error message.

Replies are listed 'Best First'.
Re^4: WIN32::OLE bridging to MATHCAD
by forgedascendant (Novice) on Apr 21, 2009 at 13:49 UTC
    My ignorance seems to be hindering me. I looked over the Win32::OLE->LastError and implimented the following:
    #!/usr/ym/util/perl use Win32::OLE; #Perl "C:/documents and settings/aaron.verellen/desktop/trial2.pl" #Win32::OLE->Initialize(COINIT_OLEINITIALIZE); Win32::OLE->Option(Warn => 2); #use existing instance if mathcad is already running eval {$MC = Win32::OLE->GetActiveObject('Mathcad.Application')}; die "Mathcad not installed" if $@; unless (defined $MC) { $MC = Win32::OLE->new('Mathcad.Application', sub{$_[0]->Quit;}) or die "Unable to start Mathcad"; } #Open specific worksheet my $filePath = 'C:\Documents and Settings\aaron.verellen\Desktop\testM +12.xmcd'; my $WS = $MC->Worksheets; my $S = $WS->Open($filePath); #Set values on the worksheet $S->setValue('x',50); $S->setValue('y',60); $S->setValue('z',70); $S->Recalculate; my $test = $S->getValue('x'); my $err = Win32::OLE::LastError(); print "*$err\n"; print "test = $test\n"; my $answer1 = $S->getValue('output1'); my $answer2 = $S->getValue('output2'); print "($answer1,$answer2)\n";
    When I run the above script I get:

    C:\>Perl "C:/documents and settings/aaron.verellen/desktop/trial2.pl"
    Win32::OLE(0.1709) error 0xc00000fd
    in METHOD/PROPERTYGET "getValue" at C:/documents and settings/aaron.verellen /desktop/trial2.pl line 31
    *Win32::OLE(0.1709) error 0xc00000fd
    in METHOD/PROPERTYGET "getValue"
    test =

    The information gleamed off the lasterror technique appears to be the same as the error message recieved before. My first though is I didn't impliment it correctly. Would you please take the time and correct my ignorance Anonymous Monk so that whatever clues you seek I can give you?

    Thank you so much for everything you have done thus far,
    Aaron