Ruby Gnuplot隐藏命令行提示符终端

Ruby Gnuplot隐藏命令行提示符终端,ruby,windows,terminal,gnuplot,command-prompt,Ruby,Windows,Terminal,Gnuplot,Command Prompt,我在我的一个应用程序中运行Gnuplot,每次生成一个图形并运行可执行文件时,Windows命令行提示符会显示一小段时间,然后自动关闭。是否有办法隐藏终端并防止其显示 下面是我正在使用的代码的一部分: # Create gnuplot Gnuplot.open do |gp| Gnuplot::Plot.new( gp ) do |plot| plot.set("terminal", "png small size 800,500") plot.set("

我在我的一个应用程序中运行Gnuplot,每次生成一个图形并运行可执行文件时,Windows命令行提示符会显示一小段时间,然后自动关闭。是否有办法隐藏终端并防止其显示

下面是我正在使用的代码的一部分:

# Create gnuplot
Gnuplot.open do |gp|
    Gnuplot::Plot.new( gp ) do |plot|
        plot.set("terminal", "png small size 800,500")
        plot.set("title", File.basename(@current_epw_file))
        plot.set("ylabel", "\"y1\" rotate by 0")
        plot.set("y2label", "\"y2\" rotate by 0")
        plot.set("bmargin", "7")
        if (@show_grid)
            plot.set("grid")
        end

        plot.set("xdata","time")
        plot.set("timefmt", "\"%m/%d %H:%M\"")
        plot.set("format", "x \"%m/%d\\n%H:%M\"")
        plot.set("xrange", xrange)
        plot.set("y2tics")
        plot.set("key", "under")

        # Insert day markers if that option is selected
        if (@mark_days)
            day_markers = generate_day_markers(xrange)
            day_markers.each do |marker|
                plot.set("arrow", "from \"#{marker} 0:00\",graph(0,0) to \"#{marker} 0:00\",graph(1,1) nohead")
            end
        end

        plot.set("output", "weather_display.png")
        plot.data = []

        # Load all the data sets
        for file in dataset_files
            plot.data << Gnuplot::DataSet.new( "'#{file}'" ) do |ds|
                weather_parameter_object = @requested_parameters.slice!(0)

                ds.with = @with_value

                # Check thick lines option
                if (!@thick_lines)
                    ds.linewidth = 1
                else
                    ds.linewidth = 2
                end

                ds.using = "1:3"
                y_axis = @parameter_axes.slice!(0)
                ds.axes = "x1y#{y_axis}"
                if (using_both_axes)
                    ds.title = "#{weather_parameter_object.name} (#{weather_parameter_object.units}) [y#{y_axis}]"
                else
                    ds.title = "#{weather_parameter_object.name} (#{weather_parameter_object.units})"
                end
            end 
        end
    end

    path = Plugin.dir + "/lib/ruby/ruby/gems/1.8/gems/gnuplot-2.6.2/gnuplot/bin/weather_display.png"
    while (File.exists?(path) and File.size(path) > 0)
        # Wait until image has been created
    end

end
#创建gnuplot
Gnuplot.open do|gp|
Gnuplot::Plot.new(gp)do | Plot|
绘图集(“终端”,“png小尺寸800500”)
plot.set(“title”,File.basename(@current_epw_File))
plot.set(“ylabel”,“y1”旋转0)
plot.set(“y2label”,“y2\”旋转0”)
绘图集(“bmargin”、“7”)
如果(@show_grid)
绘图集(“网格”)
结束
plot.set(“扩展数据”、“时间”)
plot.set(“timefmt”,“\%m/%d%H:%m\”)
plot.set(“格式”,“x\%m/%d\\n%H:%m\”)
plot.set(“xrange”,xrange)
绘图集(“y2tics”)
绘图设置(“键”、“下”)
#如果选择了该选项,请插入日期标记
如果(@mark_天)
日标记=生成日标记(xrange)
每一天都做标记|
plot.set(“箭头”,“从\“{marker}0:00\”,图形(0,0)到\“{marker}0:00\”,图形(1,1)nohead”)
结束
结束
plot.set(“output”,“weather\u display.png”)
plot.data=[]
#加载所有数据集
对于数据集_文件中的文件
绘图(数据0)
#等待图像创建完成
结束
结束

rubyw.exe,而不是ruby.exe?问题是我正在为Trimble SketchUp开发一个插件,所以我实际上没有调用ruby可执行文件。是的,在进一步调查之后,似乎你必须使用一些ffi CreateProcess love(见上面的链接),它…gnuplot不支持hmm。。。