473,411 Members | 2,031 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,411 software developers and data experts.

Controlling a command line program from a GUI

I'd like to create my own mini "IDE" for working with several
programming languages that provide interactive "toplevel" command line
interpreters, such as Python, Ruby, Lisp, Scheme, OCaml, etc. (For
those who haven't played with them, these languages -- unlike C, Java,
C#, or Perl -- are designed to let you carry on an interactive
conversation with them, so you can run each function in your app
independently and interactively from a command prompt.) Several of
these languages have sort of clunky, half-built, 3rd party GUI front
ends for their interpreters, but nothing that I like lets me work in
all of those languages.

I imagine I'll have a multipane C# "Form" containing a tabbed window
for source code, another window pane that is essentially a command
line terminal running the language interpreter that I can interact
with directly, and some buttons/menu items that issue commands to the
Lisp, Python, etc., interpreter: a GUI front end that works for a
variety of interpreters.

What I don't have any idea how to do is to create the terminal window
part and have it act as a command line for an interpreter, nor do I
know how to send the interpreter commands from both the terminal pane
and in response to GUI events (buttons, menus, etc.). Of course I may
need to customize it to some extent for each interpreter I want to
use, but some of it must be generic, too. After all, a "DOS window" is
a GUI app that can provide the I/O for all of these interpreters
without any customization of the DOS window. What I imagine is that
the commands I send are custom, but the way a GUI app works as a front
end to an interactive command line app is generic, and that's what I
don't know how to do.

Any advice, pointers, code snippets, etc. would be appreciated.

Thanks.
Nov 15 '05 #1
3 4175
Check out the Process class. Redirect the StandardOutput and StandardInput
(and probably StandardError as well). It should be quite easy so long as the
CLI you are running was written properly.

"Tuang" <tu******@hotmail.com> wrote in message
news:df**************************@posting.google.c om...
I'd like to create my own mini "IDE" for working with several
programming languages that provide interactive "toplevel" command line
interpreters, such as Python, Ruby, Lisp, Scheme, OCaml, etc. (For
those who haven't played with them, these languages -- unlike C, Java,
C#, or Perl -- are designed to let you carry on an interactive
conversation with them, so you can run each function in your app
independently and interactively from a command prompt.) Several of
these languages have sort of clunky, half-built, 3rd party GUI front
ends for their interpreters, but nothing that I like lets me work in
all of those languages.

I imagine I'll have a multipane C# "Form" containing a tabbed window
for source code, another window pane that is essentially a command
line terminal running the language interpreter that I can interact
with directly, and some buttons/menu items that issue commands to the
Lisp, Python, etc., interpreter: a GUI front end that works for a
variety of interpreters.

What I don't have any idea how to do is to create the terminal window
part and have it act as a command line for an interpreter, nor do I
know how to send the interpreter commands from both the terminal pane
and in response to GUI events (buttons, menus, etc.). Of course I may
need to customize it to some extent for each interpreter I want to
use, but some of it must be generic, too. After all, a "DOS window" is
a GUI app that can provide the I/O for all of these interpreters
without any customization of the DOS window. What I imagine is that
the commands I send are custom, but the way a GUI app works as a front
end to an interactive command line app is generic, and that's what I
don't know how to do.

Any advice, pointers, code snippets, etc. would be appreciated.

Thanks.

Nov 15 '05 #2

Hi Tuang,

Thanks for posting in this group.
Just as Matt said, you can manipulate the standardinput and standardoutput
from Process.StandardIutput and Process.StandardOutput property.
Before you use these 2 properties, you must have specified true for the
StartInfo property's RedirectStandardIutput, RedirectStandardOutput
property.
While UseShellExecute on the StartInfo property must be false if you want
to set StandardOutput to true.
Or exception will generate.

Hope this helps,
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 15 '05 #3
I made an app that does exactly what you need, which I posted on PSCode a
couple weeks ago.
http://www.pscode.com/vb/scripts/Sho...1812&lngWId=10

Chris "kaze" Lajoie

"Tuang" <tu******@hotmail.com> wrote in message
news:df**************************@posting.google.c om...
I'd like to create my own mini "IDE" for working with several
programming languages that provide interactive "toplevel" command line
interpreters, such as Python, Ruby, Lisp, Scheme, OCaml, etc. (For
those who haven't played with them, these languages -- unlike C, Java,
C#, or Perl -- are designed to let you carry on an interactive
conversation with them, so you can run each function in your app
independently and interactively from a command prompt.) Several of
these languages have sort of clunky, half-built, 3rd party GUI front
ends for their interpreters, but nothing that I like lets me work in
all of those languages.

I imagine I'll have a multipane C# "Form" containing a tabbed window
for source code, another window pane that is essentially a command
line terminal running the language interpreter that I can interact
with directly, and some buttons/menu items that issue commands to the
Lisp, Python, etc., interpreter: a GUI front end that works for a
variety of interpreters.

What I don't have any idea how to do is to create the terminal window
part and have it act as a command line for an interpreter, nor do I
know how to send the interpreter commands from both the terminal pane
and in response to GUI events (buttons, menus, etc.). Of course I may
need to customize it to some extent for each interpreter I want to
use, but some of it must be generic, too. After all, a "DOS window" is
a GUI app that can provide the I/O for all of these interpreters
without any customization of the DOS window. What I imagine is that
the commands I send are custom, but the way a GUI app works as a front
end to an interactive command line app is generic, and that's what I
don't know how to do.

Any advice, pointers, code snippets, etc. would be appreciated.

Thanks.

Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Mike Finister | last post by:
Hi there At the moment I am writing a GUI front-end that in the background is to call some scripts on a Unix box. The GUI has to be written in Visual Basic (yes I said the VB word...sorry! :-) )...
7
by: Steve M | last post by:
I'm trying to invoke a Java command-line program from my Python program on Windows XP. I cannot get the paths in one of the arguments to work right. The instructions for the program describe the...
6
by: Edd Dawson | last post by:
Hi. I have a strange problem involving the passing of command line arguments to a C program I'm writing. I tried posting this in comp.programming yesterday but someone kindly suggested that I'd...
5
by: Daniele | last post by:
Hi, how is it possible to create a project with a specific template, compile it and close it? All with a c# script. Thanks, Daniele
2
by: tim | last post by:
Hi all, I'm almost as new to this list as to python so I hope I don't get a "this has been answered a 100 times before" or anything... Currently I am using a program named 'Macro Scheduler' for...
8
by: GaryDean | last post by:
We have been noticing that questions on vs.2005/2.0 don't appear to get much in answers so I'm reposting some questions posted by some of the programmers here in our organization that never got...
3
by: Double Echo | last post by:
Hi all, I'm using PHP 4.4.2, and use PHP on both the command-line and the web. I am running PHP on SuSE 10 Linux , in a VMware 5.5 workstation, using Apache 2.0.55 , on my Dell laptop. ...
0
by: ngolding | last post by:
I could not reply to the original thread I found on this subject: http://www.thescripts.com/forum/thread233220.html But I found a great article that describes how to accomplish this goal. ...
51
by: Ojas | last post by:
Hi!, I just out of curiosity want to know how top detect the client side application under which the script is getting run. I mean to ask the how to know whether the script is running under...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.