Out-BootsImage not recognized

May 30, 2010 at 5:07 PM

I'd really like to use PowerBoots functionality to save VisiCharts as images as shown here: http://huddledmasses.org/powerboots-output-graphs-to-images-from-powershell/

I'm able to display a graph using sample 19:

Boots {
      Chart -MinWidth 200 -MinHeight 150 -Theme Theme3 {
         DataSeries {
            DataPoint -YValue (Get-Random 100)
            DataPoint -YValue (Get-Random 100)
            DataPoint -YValue (Get-Random 100)
            DataPoint -YValue (Get-Random 100)
   } -Title "Sample, Theme 3"
But once I try to pass it to Out-BootsImage, I get the message "The term 'Out-BootsImage' is not recognized as the name of a cmdlet, function, [...]". Did I do something wrong during the installation? I already applied the fix proposed at the end of http://powerboots.codeplex.com/Thread/View.aspx?ThreadId=60155

Jun 1, 2010 at 2:20 AM

I believe Out-BootsImage was renamed to Export-BootsImage -- there's also a "New-BootsImage" function that's just a wrapper around it ...

Jun 1, 2010 at 7:47 AM

Thank you for your reply!

Can someone give me a working code example for saving a screenshot?

When I try this:

Button -Content "Push Me" | Export-BootsImage abc.jpg

I get an error message: "The parameter value must be greater than zero. Parameter name: pixelWidth". Same when I try to capture a graph like in the aforementioned example. When I wrap the Button in a Boots { } window, nothing happens, it seems.

I get all my info from http://huddledmasses.org, please tell me if there is a more up to date reference...

Jun 2, 2010 at 2:42 AM

Look at New-BootsImage ... it's a script in the PowerBoots folder.  Basically, taking a screenshot of a window goes like this:

New-BootsWindow  {
    Button "click me"
} -On_ContentRendered {
    Export-BootsImage ScreenShot.png $this
You can put whatever window content you want where I put the Button, and you can optionally specify the DPI and PixelFormat

Jun 5, 2010 at 6:18 PM

Thank you for your help! I got it working like this. If it's useful for anyone, this is how I made a column graph for a bunch of lines in a CSV file (for use in a video):

$counter = -1


Get-Content $file | % {
    if ($counter -eq -1) {
        $xLabels = $_ -split ","
    } else { if ($counter -le 2500) {
        $data = $_ -split ","
        New-BootsWindow {
        	$chart = New-Object Visifire.Charts.Chart
        	$chart.Height    = 300
        	$chart.Width     = 600 
        	$chart.Watermark = $false
        	$chart.AnimationEnabled = $false#

		$chart.View3D = $true
		$chart.BorderBrush = [System.Windows.Media.Brush]"Gray"
		$chart.CornerRadius = [System.Windows.CornerRadius]10
		$chart.BorderThickness = [System.Windows.Thickness]2.5

		$chart.Background = "#DDFFFFFF"

        	$ds = New-Object Visifire.Charts.DataSeries
        	$ds.RenderAs = [Visifire.Charts.RenderAs]"Column"
		for ($i = 0; $i -lt $data.length; $i++) {
			$dp = new-object Visifire.Charts.DataPoint
			$dp.YValue = [int]($data[$i])
			$dp.AxisXLabel = $xLabels[$i]
		$axisY = New-Object Visifire.Charts.Axis
		$axisY.AxisMaximum = 2000
		$axisY.Title = "ABCDEF"
		$axisY.Interval = 200

        } -On_ContentRendered {
            Export-BootsImage ($outFolder + "graph" + ("{0:D5}" -f $counter) + ".png") $this

It's not easy finding working samples for this cutting edge kind of stuff :)