Jump to content

Grabbing command prompt window contents


Recommended Posts

Not sure if this classifies as a GUI question or not. Does anyone know an alternative API-style method of getting the contents of a command prompt buffer? I can do it with SEND("! es{Enter}") which uses the system menu to select all the text and copies it to the clipboard, but that makes the screen flash white every time.

Link to comment
Share on other sites

AFAIK the only other way is to spawn it with Run() and grab the information through pipes. If I understand correctly, it is because the command prompt window is a rendered bmp, and doesn't have visible text/controls like Windows applications.

I don't know if it is possible to capture Pipes from a user-spawned Cmd window, or if a Run()-spawned instance would allow interaction by the user.

If you don't need interactivity, but just want to grab the output of a program, let me know, I've got a code snippet that does that.

#fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...