Rational Doors 9.6 interfacing with C# - ibm-doors

I am using Rational Doors 9.6 as client. I try to integrate a feature in my C# program such is using Doors C API, to open a view and get some data in memory for further using. This includes login to Doors server with windows credentials.
Actually, I have to start Doors Client, open that view, do a excel export, then do a C# import which is not quite the elegant way.
I am not Doors expert so all I need is a opinion, since API is in C and I'm not sure this is the way, or just using DXL server (or both?)
I have been using un-managed C dll's in C# in the past, so if proper declared, should be no problems.

The DOORS C API is a very old artifact and not usable for your purpose.
You have to use a DXL script to perform the actions inside DOORS that you want (export). To launch the script you have three options:
invoke the DXL script in batch mode
The most stable approach. You should write the information to a file from your DXL and read it back from your c#. All "professional" DOORS interfaces (like MDWorkbench) use this approach.
invoke the DXL script in "interactive batch" (see below)
See below. You need to use this if you want to automate an existing GUI DXL script. See an example here:
https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014305335&ps=25
invoke the DXL script over COM
For this you need to start the client in interactive mode and then connect to it over COM. For a discussion on that see here:
https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014458173&ps=25
For the export itself there are many scripts on the rational forum. The fastest way to go, is to perform a CSV export yourself. See here:
https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014627043&ps=25

Related

Send Commands to Delphi Application with Lua Script

I would like to be able to access TButton TCheckBox TEdit etc.. of a running Delphi application from a Lua script.
It is a retail Delphi application so I have no access to the source code. I would normally use AutoHotKey but would like more control.
Is this possible as I seem to be able to change things with the Enabler below. Could it be done by integrating Lua into a Delphi app and use it to send to the retail Delphi app ?
Or is there another way ?
An open source solution would be best so to make it available to others.
I use Reaper DAW and it has API for Lua scripting I would like to be able to do similar with the Delphi app without the API available.
In order to run any script in a specific application then that specific application needs to have suitable scripting capabilities built into it in order to be able to interpret that script accordingly.
Now I'm guessing that "retail" application you are using doesn't have LUA scripting built into it otherwise you probably wouldn't be here.
So I'm afraid that the answer is no. You can't interact with a third part application from LUA script unless that application is designed to work with LUA scripts.

Automation of PowerShell from Delphi?

Can PowerShell be automated? I.e. is there a COM interface to PowerShell that can be imported into Delphi as a type-library interface to automate it, and if so, what is the relevant file name(s)?
Googling, etc, I've found numerous references to automating things from within a PowerShell script, but I haven't been able to find anything to say whether or not I could control PowerShell itself via COM as I could it it were MS Word or whatever, and maybe receive events from it. What I'm wanting to do is to hand it a command from within a Delphi app to execute some arbitrary CmdLet and get status information back from it while it's executing the script (otherwise I'd make do with doing a ShellExecute on it).
I'm not sure whether the fact that I have been able to find anything is because PowerShell is by design not automatable or because I haven't managed to frame an effective query that filters out all the automation that can be done using PowerShell as a script host.
This is using XE8 on Win7 64-bit or its Win10 upgrade, btw.
Elaborating on RaelB's suggestion of http://delphidabbler.com/software/consoleapp:
This worked for me since Powershell itself can be run as a console app. If you wanted to run CmdLet "abc -param", then you would call the Execute method of a TPJConsoleApp instance:
app.Execute ('powershell -command abc -param')
Peter Johnson (delphiDabbler) provides several examples for interacting with the console app via pipes, files, etc. to get your status information back from the Cmdlet's stdOut (stdIn and stdErr are also available). Working code can be quickly derived from the most appropriate example.
Optionally you may want to provide additional parameters for powershell:
https://msdn.microsoft.com/en-us/powershell/scripting/core-powershell/console/powershell.exe-command-line-help

Running a Rascal program from outside the REPL

I'd really like to be able to run some Rascal's program from outside the REPL (e.g. as part of a script, or called from another program). What I'm using Rascal for is and intermediate stage in a larger framework so I am wondering what the best way to go about integrating executing the Rascal code from another program.
Right now the best way is to package your code together with the Rascal shell executable jar. There is a convenience class JavaToRascal for calling into Rascal code. Sometimes it requires some thinking to add your own modules to the Rascal search path using IRascalSearchPathContributors, but if you include a RASCAL.MF file with the right properties it all should go automatically.
If you are thinking of an Eclipse plugin, then the best way is to let your plugin depend on the rascal-eclipse plugin and use ProjectEvaluatorFactory to get access to the interpreter.
Caveat: since we are moving to a compiled system, the code you write for this kind of integration will change. This is the reason we haven't documented the API for calling Rascal from Java yet.
As I was pondering the same question, this is the (maybe trivial) answer I came up with:
java -jar /path/to/rascal-shell-stable.jar path/to/myProgram.rsc
You have to be aware that Rascal calculates module names from the current directory (don't know if it supports something like Java's CLASS_PATH), so in the above example myProgram.rsc should have a module declaration of module path::to::myProgram. Calculated and declared module name have to match.

How to run external executable (.exe ) in C++

I'm not a developper. We want ( me and our team)to write a tool in C++ that can print a PDF ( Send a PDF to printer). We tried to use external tool, like a command line pdfprint.exe, using CreateProcessW and cmd /c, but we have a problem. With Windows XP we don't have problem with our tool, with Windows Vista we have problem and we cannot using the tool like pdfprint.exe.
There are differences between Windows XP and Vista to launch external tools within another program with CreateProcessW and "cmd /c"?
Thanks
Oronzo
There are many approaches to run external application from your C++ programm. I will count them below.
Win32API CreateProcess function. Cédric Julien gave example of use.
exec* C/C++ function family. They are defined in POSIX standard. So they are the same on Linux. But because they are deprecated in new version of MSVC, try to use analogical _exec* function.
WiNT Native API Call - NtCreateProcess. It is called in CreateProcess also :-) And this function represents deeper level of API. With use of Native API calls you can write small and simple applications, because you will make lesser number of dependencies of your program with external libraries. But there are issues: native API is binded to OS version, so there aren't any garanties that Native API will be the same in next OS versions.
You may try each. Please, note that it is good idea to point in each call to these functions full path to executable file. Also you must have read/execute rights (permissions) on pdfprint.exe. If you don't have such only way to execute external tool is to run your C++ program with administrative rights. You can run it such way if you right click on exe-file of your program and select "Run As Administrator" menu element.
As described here, you should use something like this :
LPTSTR szCmdline = _tcsdup(TEXT("C:\\Program Files\\....\\pdfprint.exe -args-you-need"));
CreateProcess(NULL, szCmdline, /* ... */);

How do I implement an F# Read Eval Print Loop (REPL)?

I would like to add an F# REPL to my application for live debugging purposes. I am looking at the source code for fsi.exe (F# Interactive) and there is a ton of stuff going on that looks like it pokes around with F# compiler internals. I cannot get this same code to compile in the context of our application because of this.
Is there a nice simple example of implementing an F# REPL somewhere? I would have hoped for this to be fairly easy.
The short answer is that F# (unfortunatelly) doesn't currently provide any API for hosting F# Interactive in your applications. There are a lot of people asking for this - see for example this SO question.
There are essentially two things you could do about that:
You can modify the open-source release and compile fsi.exe as some DLL library that would provide the API you need. This isn't simple task - F# Interactive is tightly bound with the compiler (it compiles code you enter on the fly), but it should be doable to encapsulate the types implementing REPL into some type you could call (But you cannot just take some file out of it - you need to compile entire F# to get this working).
You can run fsi.exe as a separate process as Visual Studio does and send commands to it using standard input/output. You can get some more flexibility by loading your library when fsi.exe starts. The library could use .NET Remoting to connect back to your application and expose some data.
Unfortunatelly, these two options are probably the only things you can do at the moment.
EDIT I was thinking that I already answered this question somewhere (perhaps in email), but couldn't
find it! Thanks to Mauricio who found the exact duplicate (even with my duplicate answer... Doh!)
I've written a series of blog posts about using the open source F# interactive executable inside and WPF application.
The code base is available on github - https://github.com/oriches/Simple.Wpf.FSharp.Repl
The series of blog posts are:
http://awkwardcoder.blogspot.co.uk/2013/12/simple-f-repl-in-wpf-part-1.html
http://awkwardcoder.blogspot.co.uk/2013/12/simple-f-repl-in-wpf-part-2.html
http://awkwardcoder.blogspot.co.uk/2013/12/simple-f-repl-in-wpf-part-3.html
The final post is to follow soon.

Resources