473,772 Members | 2,965 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 4217
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
3922
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 as a parameter). I can get the password securely from the user in the GUI...but I have to somehow...
7
4737
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
2935
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 line arguments to the program, the behaviour of one of the functions changes mysteriously. I have...
5
1616
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
1970
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 movement, starting programs, checking the state of a window, changing the focus, type text into an input...
8
2185
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 TableAdapter:Dataset) automatically fills the Gridview. How can we control that fill? In a...
3
3038
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
937
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
4159
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
9620
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10261
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10104
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10038
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
8934
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6715
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2850
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.