shell to gnuplot

I need plot some data using gnuplot which I am starting from xojo. I can get the gnuplot program to start up but I can not send it any commands.

Dim sh As New Shell
sh.Execute(“C:\Program Files\gnuplot\bin\wgnuplot.exe”)
sh.Write(“plot sin(x)” + EndOfLine.UNIX )

I am using xojo 2107r3 on windows 7.

How would you do that in the command prompt ?

So is it possible?

It should be. I don’t think this line will execute, though :

sh.Write("plot sin(x)" + EndOfLine.UNIX )

That is why I asked what you would type in the command prompt.

Usually, you feed data to a console program by adding the parameters right after the program path, something like that :

Dim sh As New Shell sh.Mode=2 sh.Execute("C:\\Program Files\\gnuplot\\bin\\wgnuplot.exe Write(""plot sin(x)"")")

I just gazed at a Gnuplot tutorial.

From what I see, the correct code would be something like:

Dim sh As New Shell sh.Mode=2 sh.Execute("C:\\Program Files\\gnuplot\\bin\\wgnuplot.exe") sh.Execute("Write(""plot sin(x)""" + EndOfLine.UNIX )

I am not sure about EndofLine.Unix. By default, Xojo EndOfLine is for the platform it executes on. If you use EndofLine.Unix under Windows, it will not work.

Another issue is that Xojo’s shell uses a new shell for each execute. I am not sure that will work with a gnuplot session.

You may want to try it with the interactive shell example project at
/Example Projects/Advanced/Shell/Interactive Shell.xojo_binary_project

If that did not work, you may need to create a gnuplot commands script which can be fed from the command line.