the wrong forum, but.... (executing shell command on selected text)

  • Thread starter Thread starter sklett
  • Start date Start date
S

sklett

Hi-
I apologize for asking this in the wrong forum, but I can't think what
would be the correct one, OR... I can't find the correct one.

Basically, I would like to execute a shell command on selected text. For
example, after you install the google toolbar, you can search google based
on the text that you have selected in a window.

How is this done, anyone know?

Thanks and sorry again,
Steve
 
I don't know if I understand your question correctly...
but did you have something like this in mind:

you would type "iexplore index.htm" in some textbox and
then you would like to launch that?

If this is what you want then:
string[] strings = textbox.Text.Split(' '); // split word separated by " ";
Process stopServer = new Process(); // create a process

stopServer.StartInfo.FileName = strings[0]; // filename you want to start

stopServer.StartInfo.Arguments = strings[1]; // that's the argument to
the app you are starting


// you can have more arguments than one

stopServer.StartInfo.CreateNoWindow = false; // create a window?

stopServer.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; // hide the
window

stopServer.Start(); // start the process

stopServer.WaitForExit(); // wait until the process has ended



I hope this is what you wanted...
 
Back
Top