[squeak-dev] calling a external executable
David T. Lewis
lewis at mail.msen.com
Mon Jan 10 14:59:24 UTC 2011
On Mon, Jan 10, 2011 at 01:43:16PM +0100, Bert Freudenberg wrote:
> On 10.01.2011, at 13:20, arunabh2k wrote:
>
> > Hi All,
> >
> > I am trying to find out a way to call external executable and grab the input
> > from the same when a button(which I would be creating) is clicked.
> > As I am new to squeak programming it would be great help if anyone can guide
> > me how to achieve this.
>
> As a beginner you should ask this kind of question in the beginners forum:
>
> http://forum.world.st/Squeak-Beginners-f107673.html
>
> Here on squeak-dev the answer you would typically get is "use OSProcess" and you're kind-of expected to work out most of the rest yourself ;)
>
Well here are a couple more clues ;)
If you are using Unix, Linux or Mac OS X, then you can use OSProcess and
CommandShell for this. Use a Monticello browser to load these packages
from SqueakSource:
http://www.squeaksource.com/OSProcess
http://www.squeaksource.com/CommandShell
Look for classes ProxyPipeline and PipeableOSProcess. Either of these will
do what you want. Based on your description of what you want to do, I
think that ProxyPipeline may be the better choice, because it works at
a higher level and cleans up after itself after you run the command.
The basic idea is to evaluate something like this:
(ProxyPipeline command: 'ls | cat | wc') upToEndOfFile
So if you hook this up to your button, you should have what you want.
Additional information is here:
http://wiki.squeak.org/squeak/708
http://wiki.squeak.org/squeak/1914
If you are using Windows, this will not quite work, so look for package
ProcessWrapper on SqueakSource.
Dave
More information about the Squeak-dev
mailing list
|