From: Richard Owlett on
Robert Heller wrote:

> At Wed, 10 Dec 2008 13:51:32 -0600 Richard Owlett <rowlett(a)atlascomm.net> wrote:
>
>
>>My OS is WinXP.
>>
>>I've had many occasions to use Microsoft Word's VBA to control other
>>Windows programs. It can be a kludge, but it got the job done.
>>
>>Is there a Tcl equivalent to
>>
>>Pgmhandle = Shell("G:\gnuplot\bin\wgnuplot.exe", 1)
>>AppActivate Pgmhandle
>>SendKeys " plot 'C:dataset1.dat' using 1:3" + Chr$(13) + Chr$(10), 1
>> ' do something
>>SendKeys " plot 'C:dataset2.dat' using 2:3" + Chr$(13) + Chr$(10), 1
>>
>
>
> In the case of gnuplot, you really just want to write to its stdin, so
> you can do:
>
> # Fork process, with is stdin connected to a pipe (ala popen).
> # The open file handle is connected to the pipe.
> set plotfp [open "|G:/gnuplot/bin/wgnuplot.exe" w]
> # Write commands to the pipe...
> puts $plotfp " plot 'C:dataset1.dat' using 1:3"
> puts $plotfp " plot 'C:dataset2.dat' using 2:3"
> # Close the pipe.
> close $plotfp;# sends an EOF
>
> (Ideally, you want to put a catch around the open and maybe use
> fileevent as well.)
>
>

It didn't work :(
Gnuplot opened, but nothing seemed to go to the opened window.
From: pwelten on
Richard Owlett schreef:
> My OS is WinXP.
>
> I've had many occasions to use Microsoft Word's VBA to control other
> Windows programs. It can be a kludge, but it got the job done.
>
> Is there a Tcl equivalent to
>
> Pgmhandle = Shell("G:\gnuplot\bin\wgnuplot.exe", 1)
> AppActivate Pgmhandle
> SendKeys " plot 'C:dataset1.dat' using 1:3" + Chr$(13) + Chr$(10), 1
> ' do something
> SendKeys " plot 'C:dataset2.dat' using 2:3" + Chr$(13) + Chr$(10), 1


You could have a look at Cwind: http://wiki.tcl.tk/5019

Peter
From: David Gravereaux on
Richard Owlett wrote:

> It didn't work :(
> Gnuplot opened, but nothing seemed to go to the opened window.

Look in the bin directory. IIRC, there is another executable
specifically for using with pipes.
From: Robert Heller on
At Wed, 10 Dec 2008 14:12:33 -0600 Richard Owlett <rowlett(a)atlascomm.net> wrote:

>
> Robert Heller wrote:
> > At Wed, 10 Dec 2008 13:51:32 -0600 Richard Owlett <rowlett(a)atlascomm.net> wrote:
> >
> >
> >>My OS is WinXP.
> >>
> >>I've had many occasions to use Microsoft Word's VBA to control other
> >>Windows programs. It can be a kludge, but it got the job done.
> >>
> >>Is there a Tcl equivalent to
> >>
> >>Pgmhandle = Shell("G:\gnuplot\bin\wgnuplot.exe", 1)
> >>AppActivate Pgmhandle
> >>SendKeys " plot 'C:dataset1.dat' using 1:3" + Chr$(13) + Chr$(10), 1
> >> ' do something
> >>SendKeys " plot 'C:dataset2.dat' using 2:3" + Chr$(13) + Chr$(10), 1
> >>
> >
> >
> > In the case of gnuplot, you really just want to write to its stdin, so
> > you can do:
> >
> > # Fork process, with is stdin connected to a pipe (ala popen).
> > # The open file handle is connected to the pipe.
> > set plotfp [open "|G:/gnuplot/bin/wgnuplot.exe" w]
> > # Write commands to the pipe...
> > puts $plotfp " plot 'C:dataset1.dat' using 1:3"
> > puts $plotfp " plot 'C:dataset2.dat' using 2:3"
> > # Close the pipe.
> > close $plotfp;# sends an EOF
> >
> > (Ideally, you want to put a catch around the open and maybe use
> > fileevent as well.)
> >
> >
>
> I had understood that Windows(tm) did not implement pipes in
> conventional sense. Used to use them in good old 8-bit CPM days.
>
> Will try your code.

Current versions of Tcl implement some sort of pipe logic as part of a
compatibility library or something.

>
>

--
Robert Heller -- Get the Deepwoods Software FireFox Toolbar!
Deepwoods Software -- Linux Installation and Administration
http://www.deepsoft.com/ -- Web Hosting, with CGI and Database
heller(a)deepsoft.com -- Contract Programming: C/C++, Tcl/Tk

From: Richard Owlett on
David Gravereaux wrote:
> Richard Owlett wrote:
>
>
>>It didn't work :(
>>Gnuplot opened, but nothing seemed to go to the opened window.
>
>
> Look in the bin directory. IIRC, there is another executable
> specifically for using with pipes.

I assume you are referring to wgnuplot_pipes.exe .
Didn't work either :(

I'm tight for time at moment. I'll post forensic evidence later.
Thanks to all.