Pinned topic how to call an existing JAVA/C api or console command in DXL
I am now trying to integrate DOORS with my own application, and there are two questions may need your support.
1.Is it possible to execute a console command such as "dir" in DXL and parse the output of dir into DXL for later usage?
2.If I have a set of existing java/c api, how to call these apis in DXL and leverage the return value in DXL?
Re: how to call an existing JAVA/C api or console command in DXL2011-11-10T13:28:32ZThis is the accepted answer. This is the accepted answer.1. For the executing of command line you can use system, win32SystemWait_ or the attached shell library, which also enables terminating a started application or getting its output (test code in library).
2. Leveraging an existing C API from DXL is impossible without very dirty hacks. Interfacing a Java API? Well maybe in "DOORS Next Generation ...". What you always can do is create a COM server in some language of your choice, which will then interface to your APIs. You can then use the COM server to interface to your applications. This can be done quickly, however you need some experience in COM server programming to "get it right".
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
jester76 270005JCMQ68 Posts
Re: how to call an existing JAVA/C api or console command in DXL2013-10-25T10:32:41ZThis is the accepted answer. This is the accepted answer.
- jester76 270005JCMQ
Please note that there are NO shell windows appearing, when using shell.inc to start Notepad. If there is a shell window appearing when you are using shell.inc to run something it may be, that you are running a console application (that is by itself creating a console to output stuff). The normal OS start process functions do not suppress the console of console applications when you run them. For this you need to start your console application over a separate tool, that will block the console. Details on your favorite search engine, e.g. see here: http://www.codeproject.com/Articles/2537/Running-console-applications-silently
Alternatively if you are running a tool, that you created yourself, just link it as a non console application.
Regards, MathiasUpdated on 2013-10-25T10:33:34Z at 2013-10-25T10:33:34Z by Mathias Mamsch
Re: how to call an existing JAVA/C api or console command in DXL2013-10-25T10:51:26ZThis is the accepted answer. This is the accepted answer.
- Mathias Mamsch 2700025PVX
It seems the WScript OLE object also allows you to start an application without a window. So in this case, you have to use the "Run" method instead of the exec method and pass 0 (hide) as a second argument. But in this case you cannot get the output of the process or terminate it, so that is something that cannot be patched in shell.inc. So something like this should get you started:
OleAutoObj shellObj = oleCreateAutoObject "WScript.Shell"
OleAutoObj result = null
OleAutoArgs args = create()
put(args, "CMD /C CD /D C:\\ & DIR /S")
print oleMethod(shellObj, "Run", args , result)
EHcnck 2700040T9U144 Posts
Re: how to call an existing JAVA/C api or console command in DXL2016-01-14T13:22:06ZThis is the accepted answer. This is the accepted answer.
- Mathias Mamsch 2700025PVX
when I run the above code I get the following error any ideas what maybe the cause?:
OLE problem: , OLE error code: -2147024891