473,545 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4199
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******@hotma il.com> wrote in message
news:df******** *************** ***@posting.goo gle.com...
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.Standar dIutput and Process.Standar dOutput property.
Before you use these 2 properties, you must have specified true for the
StartInfo property's RedirectStandar dIutput, RedirectStandar dOutput
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******@hotma il.com> wrote in message
news:df******** *************** ***@posting.goo gle.com...
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
3896
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! :-) ) The big issue is that the command line utility that has to be used in order to access the Unix box asks for a password (you can send the user ID...
7
4719
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 following for the command-line arguments: java -jar sforcedataloader.jar -Dsalesforce.config.dir=CONFIG_DIRECTORY They also give an example:
6
2922
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 have better luck here. So here goes! My program ignores any command line arguments, or at least it's supposed to. However, when I pass any command...
5
1607
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
1953
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 automating programs that don't have a command line version. Its a simple scripting language that allows you to automate button clicks, mouse...
8
2170
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 answered... In 1.1 we always did our own myDataAdapter.fills and we liked that control for lots of good reasons. Now the new DataSource (or is it a...
3
3023
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. Everything has been running flawlessly without problems. Very amazing to use VMware, it has worked beautifully. uname -a
0
921
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. http://www.csharphelp.com/archives/archive210.html ---------------------------------------------------------------------------------------
51
4090
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 Command Prompt or Browser or some other application? Ojas.
0
7453
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
1
7410
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7742
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5318
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4940
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3441
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3436
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1865
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1007
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.