473,223 Members | 1,774 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,223 software developers and data experts.

Get output from DOS application with UI - not a command line application

Hello, all, I see there are some true experts here on the forum, so maybe someone can help me.

I need to get output from DOS application that does some calculations based on the choices that user makes in it. Thre are 4-5 choices to choose, and then the calculated data is either printed or shown on the screen. Printing works just fine, however I have a problem with previewing data. I need to preview data becuase manytimes there isnt a printer to conencti notebook to.

The problem with previewing is that data listing is several pages long, and paging doesnt occur, so 90% of the data is just scrolled out, and only the bottom lines of the listing is visible. How can I capture the whole data?

Stuff like

App.exe > c:\text.txt

doesnt work. Also, I have failed to achieve this with System.Debugging.Process class. I can get output when the application is a command line application, and when application doesnt need user interaction. However, I have some menus in this app, and user needs to interact with them, in order to get the result.

Does anyone knows for sure if this is possible or not?

Thanks,
Goran
Oct 1 '07 #1
6 1525
Plater
7,872 Expert 4TB
You have a DOS application with menus?
Does it use like DOS4GW or some other gdfx library?

The process class can do standard streams for inpute/ouput/error, but that only works for commandline.

You could try using SendKeys(), but that might require a UI window.
Oct 1 '07 #2
No, no, it is a standard DOS menu, 1), 2), 3).... a), b), c), d). Application is written in Pascal 3.0,

I don't know what did you mean by SendKeys, but If you meant to use it for choosing options, then it is not needed. User will use keyboard to select options, and in the end there is option to print or preview, so when user presses V button, the data will be displayed on the screen. This is the moment when I need to start capturing data, after the user presses V (preview). Before that I am not interested what is going on. Data is several pages long, so I can see only the last page, like when you type Dir on a folder that has 100 items, only the last 30 (lets say) are visible.

Goran
Oct 1 '07 #3
Plater
7,872 Expert 4TB
Have you tried overriding the standard in/out/error streams in the Process class?
Oct 2 '07 #4
No, I have only tried with StartInfo and rediresting output, which is used for command libe applications. Can you point me to some direction, what is the idea/goal. and what I need to override.

Thanks,
Goran
Oct 2 '07 #5
Plater
7,872 Expert 4TB
Well here's an example for a program i wrote to wrap the nslookup dos command (Yes I know there is a built in version)

nslookup by itsels waits for the user to enter in some data before responding. Redirect the standardInput to send ascii data to the process.
I read it's reply with both the standardOut and standardError (since some information is sent on standard error)

Expand|Select|Wrap|Line Numbers
  1. private string GetLookup(string IPAddy)
  2. {
  3.     string retval = "";
  4.     //ProcessStartInfo psi = new ProcessStartInfo("nslookup", "");
  5.     psi.UseShellExecute=false; 
  6.     psi.RedirectStandardOutput = true;
  7.     psi.RedirectStandardInput = true;
  8.     psi.RedirectStandardError  = true;
  9. //    psi.CreateNoWindow = true;
  10.     Process p = new Process();
  11.     p.StartInfo=psi;
  12.     p.Start();
  13.     StreamWriter si = p.StandardInput;
  14.     StreamReader se = p.StandardError; 
  15.     StreamReader so = p.StandardOutput;
  16. si.WriteLine(IPAddy);
  17. //    si.WriteLine("blank");
  18.     si.WriteLine("exit");
  19.     retval += so.ReadToEnd();
  20.     retval += se.ReadToEnd();
  21.  
  22.     while (!p.HasExited)
  23.     {
  24.         retval += so.ReadToEnd();
  25.         retval += se.ReadToEnd();
  26.     }
  27.     retval += so.ReadToEnd();
  28.     retval += se.ReadToEnd();
  29.     p.Close();
  30.     p.Dispose();
  31.     return retval;
  32. }
  33.  
Oct 2 '07 #6
You have confused me when you said "overriding". Yes, this is the code (more or less) I have used, but the problem with it is, when first options is chosed (a user types some letter), the process ends. I am not sure why, but I couldnt find a way to get around this.

Seems that I will get around with my problem with combination of two software - one that will redirect output from DOS printer to windows printer, and other that will convert this output to pdf format.

Thanks, Goran
Oct 3 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Mark Wilson CPU | last post by:
This must be easy, but I'm missing something... I want to execute a Perl script, and capture ALL its output into a PHP variable. Here are my 2 files: -------------------------------------...
3
by: Steve | last post by:
How can I read the output from a command line utility such as ping, nslookup, etc, from within my app??? I know that it is possible to output the results to a text file using the > function in a...
8
by: AMeador | last post by:
I can see console output in the output window on VS, but how can you see this text when running the app on a different machine or outside of VS? Thanks! --- Andrew
2
by: Steve | last post by:
I have created a console app that simply prints out a message a couple times, then exits, here is the code: <code> for(int i = 0; i < 10; i++) { System.Threading.Thread.Sleep(500);...
1
by: lavu | last post by:
I currently have a C# windows Application . I would like this App to work through an command line interface also. I would like to specify command line params, which should start the app and process...
6
by: tommaso.gastaldi | last post by:
Hi I am creating a pdf by just printing on Acrobat Distiller. This is fine. I need to create a pdf which has a given prespecified name and I do not wish that Distiller prompts me for a name....
4
by: garyusenet | last post by:
Hi. I am trying to learn about array lists, and found an example on MSDN. I tried to compile it but it's not producing any output. I can't see why. Any ideas? Here is what I did. 1....
0
by: ptek | last post by:
Hi, I'm using Vstudio 2005 and I did a Windows Application project where I also want to read arguments from command line and output some text when appropriate (for example, typing the correct...
1
by: leonknathan | last post by:
Hi, I'm new to posting questions on this type of forum so if I'm doing something wrong i'll be grateful for any vats of common sense any of you can send in my direction. I have a VBA question -...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.