Start doors with C# and redirect doors-output

Dear readers,

I want to start Doors as process with hidden window and I want to redirect all the doors-output to my program. But whatever I do, I cannot hide the doors-console-window and I cannot redirect the doors-output to my program. Here is my code

 

staticvoidStartDoors_03_Forum() {

System.Diagnostics.Processproc = null;

if(Process.GetProcessesByName("doors").Length == 0) {

proc = newSystem.Diagnostics.Process();

proc.StartInfo.FileName = @"C:\Program Files (x86)\IBM\Rational\DOORS\9.2\bin\doors.exe";

proc.StartInfo.Arguments = "-u abc -P def -W -batch Z:\\Doors\\StartDoorsWithCs_Cmd\\bin\\Debug\\DxlTest.dxl";

proc.StartInfo.UseShellExecute = false;

proc.StartInfo.RedirectStandardOutput = true;

proc.OutputDataReceived += (sender, args) => Console.WriteLine("received output: {0}", args.Data);

proc.StartInfo.CreateNoWindow = true;

proc.Start();

proc.BeginOutputReadLine();

proc.WaitForInputIdle();

}

proc.WaitForExit();

Console.Write("Check your DOORS output . . . ");

Console.ReadKey(true);

}


Fork - Tue Jun 25 11:23:24 EDT 2013

Re: Start doors with C# and redirect doors-output
Richard_Good - Tue Jun 25 12:05:01 EDT 2013

Not sure you have the right idea. You need to be clear what you are trying to do. You look like you are attempting to capture the DOORS standard out (anything written to the cout stream from within DOORS) this is sometimes useful for firing DOORS in batch mode and returning some limited information through it.

Then you look like you are trying to write to the DXL output screen. There is no concept of sending messages from C# to DOORS and having it write them to the screen like this or its not a good way anyway, you would have to write to the DOORS standard in stream and have a kind of doors infinite loop looking for input to process which is not very practical/ useful.

Instead fire DOORS using the COM interface and use the runStr or runFile methods to throw programs at DOORS, you can then hook out the standard out stream or use a file as an agent or use the Result property.

You need a reference to the DOORSDXL Com library, search the help and this forum for more details, then come back here if you need to.

Richard

Re: Start doors with C# and redirect doors-output
Fork - Tue Jun 25 12:43:01 EDT 2013

Richard_Good - Tue Jun 25 12:05:01 EDT 2013

Not sure you have the right idea. You need to be clear what you are trying to do. You look like you are attempting to capture the DOORS standard out (anything written to the cout stream from within DOORS) this is sometimes useful for firing DOORS in batch mode and returning some limited information through it.

Then you look like you are trying to write to the DXL output screen. There is no concept of sending messages from C# to DOORS and having it write them to the screen like this or its not a good way anyway, you would have to write to the DOORS standard in stream and have a kind of doors infinite loop looking for input to process which is not very practical/ useful.

Instead fire DOORS using the COM interface and use the runStr or runFile methods to throw programs at DOORS, you can then hook out the standard out stream or use a file as an agent or use the Result property.

You need a reference to the DOORSDXL Com library, search the help and this forum for more details, then come back here if you need to.

Richard

Thanks for your reply.

I used now RunStr(). But this opens the Dxl-Window, which I do not want to have, because my C#-Program should run in an automation-environment.

Can you give me some usefull link ?

Fork

Re: Start doors with C# and redirect doors-output
Richard_Good - Wed Jun 26 05:12:17 EDT 2013

Fork - Tue Jun 25 12:43:01 EDT 2013

Thanks for your reply.

I used now RunStr(). But this opens the Dxl-Window, which I do not want to have, because my C#-Program should run in an automation-environment.

Can you give me some usefull link ?

Fork

https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014458173

https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014951554

https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014957126

Tip, use the cunningly disguised black on black search developer works search box (this works a little) not the more prominent search this forum box (this doesn't work), don't know whats wrong with the web designers, but the search is no longer there in the forum you have to go to a higher level to get at it!!!! See threads on the forum is useless and forum moans for more details, think I might let others lead the moans as I am getting a little to noisy on this front! Note that this web site has won prizes!! How!!

Richard