Page 1 of 1
					
				DOS text to PB
				Posted: Thu Feb 17, 2005 8:51 am
				by chippy73
				Is there a way to read text that is displayed in a DOS program window and read it into PB?
I have a DOS program that displays text and I need to capture it as it appears and display it in a PB text window.
I also need to do the reverse.
Any ideas please.
(running PB 3.92 and latest JAPBe)
Thanks
Alan
			 
			
					
				
				Posted: Thu Feb 17, 2005 9:17 am
				by Jimbo_H
				Hi chippy73,
I wanted to redirect ping output to a PB window and found the answer here:
viewtopic.php?t=6544&highlight=ping+dos
Hope that helps.
Regards,
Jim
 
			 
			
					
				
				Posted: Fri Feb 18, 2005 3:56 pm
				by chippy73
				Hello Jim,
Thanks for the link. Had a look. Looks a bit heavy for me to understand but will bear it in mind if no other replies.
regards Alan
			 
			
					
				
				Posted: Fri Feb 18, 2005 8:38 pm
				by Jimbo_H
				chippy73 wrote:Hello Jim,
Thanks for the link. Had a look. Looks a bit heavy for me to understand but will bear it in mind if no other replies.
regards Alan
Hi Alan,
To be honest, it's far too heavy for me to grasp too, but it works perfectly.  I have sat and played with this code for hours, literally.  Most of it is way above my head, but I sort of understand some of it.  And that's just because I kept changing bits of the code, trying to work out why it was suddenly broken and reading up on each command.
I don't think there is a way of parsing the output of a DOS command without using the Windoze API.
Which DOS command(s) did you want to use?  That code works with other DOS commands, not just ping, so it's worth messing with it.  Try some other things.  I've had it working with traceroute and ipconfig so far, simply because those are the commands I wanted to use in my PB program.
Regards,
Jim
 
			 
			
					
				
				Posted: Sat Feb 19, 2005 10:26 am
				by chippy73
				Hello Jim,
Thanks for your comments.
What I want to do is this:-
I have a DOS program running which displays text in a DOS window. I want to capture this text and display it in a PB window. Same effect as using cut and paste which is not what I want to do.
Maybe there is a way to intercept the text before it reaches the DOS window?
I don't need to capture DOS commands at this time.
Alan
			 
			
					
				
				Posted: Sat Feb 19, 2005 2:59 pm
				by DoubleDutch
				The routine at this post works great!  
viewtopic.php?t=7399
-Anthony
 
			 
			
					
				
				Posted: Sat Feb 19, 2005 7:54 pm
				by chippy73
				Hello Anthony
Thanks - will try it
Alan
			 
			
					
				
				Posted: Sat Feb 19, 2005 7:55 pm
				by NoahPhense
				
			 
			
					
				
				Posted: Sun Feb 20, 2005 1:15 pm
				by chippy73
				Well, I've spent some time with both routines in the links above. They seems to do similar things.
They work fine with DOS commands etc, and changing it to run my dos program and running both routines I don't get the text displayed in PB, that is displayed in my dos program screen.
Obviously I need to modify the code a bit, but not sure what.
Alan
			 
			
					
				
				Posted: Sun Feb 20, 2005 1:22 pm
				by DoubleDutch
				There should be no DOS window opened on the routine I pointed you too, just the PureBasic program - it was in console mode - so it may look like DOS - but it isnt - it could easily be a window or not displayed at all - just processed.
 
 
-Anthony
 
			 
			
					
				
				Posted: Sun Feb 20, 2005 3:39 pm
				by chippy73
				Anthony,
Yes I appreciate that and see what you mean.
I think what I need to do is use something like ReadConsole or one of the Console API's that read either the input or output console buffers. Not too sure how to go about this. Any ideas please?
The DOS program is very complex and not written by me. So I am doing a 'fudge' until I can get the source codes and put it into PB properly. It basically reads in from the sound card and performs some very complex functions and then displays it as text in a DOS window.
Alan