WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

DOS

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

DOS Screen Scrape in Windows 95/NT

Keywords:  screen scrape DOS 

Question:

I am trying to capture the text of a dos application (screen shot) and then parse through that data, writing it into a flat comma dillim file to import into another db.

I can manually press the print screen key, which in full screen mode captures the text of the screen. I detect this and parse through the data, writing a line out to a text file. I need to be able to send the print screen key so that I don't have to push the key manually for over 50000 times!

I have tried sendkey("{PRTSC}") but it just sits in the clipboard. Is there anyway to force the dos program to pick this up? Are there any TSR's I could run in a Win95 DOS box to push this key for me??

Answer:

Here's a way to simulate a screen scrape, in a DOS Window:

While in the DOS window, hit the ALT key plus SPACEBAR, which brings up the DOS edit window. Then click on Edit, and Mark. Hold down the SHIFT plus RIGHTARROW keys, and go 80 spaces to right. Then hold down SHIFT plus DOWNARROW keys, and go 25 lines. Now hit ALT plus SPACEBAR to go back into the Edit menu again, and then click on Copy to the Clipboard. (Sometimes applications have a Select All feature on a menu which works nicely for highlighting the text.)

Now you can use getme=ClipGet() to retrieve the contents of the clipboard. You could also open up a copy of Notepad and do a ClipGet in Notepad. You can take a look at the variable "getme", with some of our string functions to analyze the results, or, if you save the Notepad file, you could analyze the contents in a binary buffer with our binary functions.

Your text from whatever was on your DOS screen is now in the clipboard (check by going into Notepad and pasting the contents).

Try this script. The DOS Window MUST (MUST) be running in windowed mode (not Full screen). This can be controlled from a PIF/Shortcut to DOS type file.


        SendKeysTo("~MS-DOS Prompt", "!{SPACE}ek")
        TimeDelay(1)       
        SendKey("+{down 24}+{right 80}~");SHIFT+DOWN and SHIFT+RIGHT and ENTER
        
        a=ClipGet()
        message("Contents of Clipboard", a)

Article ID:   W12883
Filename:   DOS Screen Scrape.txt
File Created: 1999:07:23:10:28:14
Last Updated: 1999:07:23:10:28:14