cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

Ole-Autmatisierung in Java

ptc-4570656
1-Newbie

Ole-Autmatisierung in Java

Hallo,

ich möchte eine OLE-Automatisierung in Java für Mathcad (ab Version 11) realisieren. Das senden der Daten über "SetComplex" klappt ohne Probleme, das auslesen der Daten mit "GetComplex" bekomme ich jedoch nicht realisiert. Dazu habe ich mit der JACOB-Bibiothek die Schnittstelle realisiert und folgenden Programmcode geschrieben:

import com.jacob.com.*;

import com.jacob.activeX.*;

public class DispatchTest

{

public static void main(String[] args)

{

ActiveXComponent xl = new ActiveXComponent("C:DispatchTest.mcd");

//Pfad des Testprogrammes, wo die Addition von in0 und in1 durchgeführt wird

Object xlo = xl.getObject();

Dispatch.call(xlo, "SetComplex", "in0", 10, 5) ;

Dispatch.call(xlo, "SetComplex", "in1", 7, 2) ;

Dispatch.call(xlo, "Recalculate") ;

//In der Mathcad-Vorlage wird nun in0 + in1 = out0

Variant RealPart = null;

Variant ImagPart = null;

Dispatch.call(xlo, "GetComplex", "out0", RealPart, ImagPart) ;

}

}

Als Fehlerbeschreibung bekomme ich einen Typenkonflikt, oder einen Nullpointer angezeigt bei dem Befehl "GetComplex". Auch der Befehl "Recalculate" kann nicht ausgeführt werden. Ist eine Umsetzung in Java überhaupt möglich? Gibt es ansonsten eine Möglichkeit dies in C++ umzusetzen?

4 REPLIES 4

Hallo, die Mehrheit der Mitglieder in englischer Sprache zu schreiben. Ich werde mein Bestes sein, eine Übersetzung zu liefern, so dass Sie eine Antwort auf Ihre Frage erhalten.

Danke

Dan

---<Translation provided by Google Translate>---


Hello,

I would like to implement an OLE automation in Java for Mathcad (version 11). The data send over "SetComplex" works without problems, the data read out with "GetComplex" I do not get implemented. In addition I have realized with the JACOB Bibiothek the interface and write the following code:

com.jacob.com import *.;

com.jacob.activeX import *.;

Dispatch public class Test

{

public static void main (String [] args)

{

ActiveXComponent xl = new ActiveXComponent ("C: DispatchTest.mcd");

/ / Path of the test program, where the addition is performed by in0 and in1

Object xlo = xl.getObject ();

Dispatch.call (xlo, "SetComplex", "in0", 10, 5);

Dispatch.call (xlo, "SetComplex", "in1", 7, 2);

Dispatch.call (xlo, "Recalculate");

/ / In the Mathcad document now in0 + in1 = out0

Real Estate Part = 0;

Variant ImagPart = 0;

Dispatch.call (xlo, "GetComplex", "out0" real part, ImagPart);

}

}

The error description I get a type mismatch, or a null pointer displayed when the command "GetComplex". Also, the command "Recalculate" can not be executed. If an implementation in Java at all possible? Is there a way to otherwise implement this in C + +?

musa1988
6-Contributor
(To:DanMarotta)

i dont know if this topic is up to date or solved. But did anyone solved it ? 

LucMeekes
23-Emerald III
(To:musa1988)

I managed to get a system with SetComplex and GetComplex working at one point, from Ms Excel. Then someone else made a frontend using a web-page, which  -may- have involved Java, and it worked as well. I do not think I have access to the stuff anymore.

I suggest, if you need this, first use Excel on a small prototype, then figure out how to implement it from a programming language.

 

Success!
Luc

musa1988
6-Contributor
(To:LucMeekes)

@LucMeekes

 

thank you for your response. I told this to my friend who is programming it and he called the customer service. they will help him 🙂

Top Tags