DOS text to PB

Windows specific forum
chippy73
User
User
Posts: 59
Joined: Wed Feb 16, 2005 6:11 pm
Location: S.W.Wales

DOS text to PB

Post 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
Jimbo_H
Enthusiast
Enthusiast
Posts: 103
Joined: Mon May 10, 2004 7:37 pm
Location: West Yorkshire, England

Post 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
chippy73
User
User
Posts: 59
Joined: Wed Feb 16, 2005 6:11 pm
Location: S.W.Wales

Post 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
Jimbo_H
Enthusiast
Enthusiast
Posts: 103
Joined: Mon May 10, 2004 7:37 pm
Location: West Yorkshire, England

Post 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
chippy73
User
User
Posts: 59
Joined: Wed Feb 16, 2005 6:11 pm
Location: S.W.Wales

Post 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
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

The routine at this post works great! :D

viewtopic.php?t=7399

-Anthony
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
chippy73
User
User
Posts: 59
Joined: Wed Feb 16, 2005 6:11 pm
Location: S.W.Wales

Post by chippy73 »

Hello Anthony

Thanks - will try it

Alan
User avatar
NoahPhense
Addict
Addict
Posts: 1999
Joined: Thu Oct 16, 2003 8:30 pm
Location: North Florida

Post by NoahPhense »

DoubleDutch wrote:The routine at this post works great! :D

viewtopic.php?t=7399

-Anthony
nice ..

- np
chippy73
User
User
Posts: 59
Joined: Wed Feb 16, 2005 6:11 pm
Location: S.W.Wales

Post 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
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post 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
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
chippy73
User
User
Posts: 59
Joined: Wed Feb 16, 2005 6:11 pm
Location: S.W.Wales

Post 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
Post Reply