<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Huddled Masses &#187; Visifire</title>
	<atom:link href="http://huddledmasses.org/tag/visifire/feed/" rel="self" type="application/rss+xml" />
	<link>http://huddledmasses.org</link>
	<description>You can do more than breathe for free...</description>
	<lastBuildDate>Sat, 28 Jan 2012 21:37:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<cloud domain='huddledmasses.org' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
		<item>
		<title>PowerBoots: PowerShell GUIs are now multi-threading</title>
		<link>http://huddledmasses.org/powerboots-now-multi-threaded/</link>
		<comments>http://huddledmasses.org/powerboots-now-multi-threaded/#comments</comments>
		<pubDate>Sat, 07 Feb 2009 23:21:24 +0000</pubDate>
		<dc:creator>Joel 'Jaykul' Bennett</dc:creator>
				<category><![CDATA[Huddled]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[DSL]]></category>
		<category><![CDATA[GUIs]]></category>
		<category><![CDATA[PowerBoots]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[User Interface]]></category>
		<category><![CDATA[Visifire]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://huddledmasses.org/?p=1045</guid>
		<description><![CDATA[Announcing the release of PowerBoots 0.1 This release of PowerBoots is the most exciting release software I&#8217;ve cranked out in awhile. It finally has almost all of the features that I have thought of so far (we&#8217;re still missing proper support for attached properties). You can create pretty much any WPF element, including ones I [...]]]></description>
			<content:encoded><![CDATA[	<h2>Announcing the release of PowerBoots 0.1</h2>

	<p>This release of PowerBoots is the most exciting release software I&#8217;ve cranked out in awhile. It finally has almost all of the features that I have thought of so far (we&#8217;re still missing proper support for attached properties).</p>

	<ul>
		<li>You can create pretty much any <span class="caps">WPF</span> element, including ones I haven&#8217;t thought of adding yet (use Add-BootsFunction to add a new assembly or a single type).</li>
		<li>You can create graphical user interfaces from <a class="zem_slink" href="http://www.microsoft.com/powershell" title="Windows PowerShell" rel="homepage">PowerShell</a> 1.0 all the way to the latest PowerShell 2.0 <span class="caps">CTP</span>.</li>
		<li>You can create your <span class="caps">WPF</span> GUIs <code>-Async</code> <span class="em1">in their own threads</span>, or inline in <a href="http://PoshConsole.CodePlex.com">PoshConsole</a>, or as synchronous dialogs that return values when they close.</li>
		<li>You can capture screenshots of your UIs (eg: <a href="http://huddledmasses.org/powerboots-output-graphs-to-images-from-powershell/">generate .jpg charts from Visifire</a>). You can even do so <strong>without displaying them!</strong></li>
		<li>You can take advantage of <a class="zem_slink" href="http://en.wikipedia.org/wiki/Extensible_Application_Markup_Language" title="Extensible Application Markup Language" rel="wikipedia">XAML</a> Data Templates to generate graphical representations of any objects in the PowerShell pipeline.</li>
	</ul>
	<ul>
		<li>You can add to, or modify your running GUIs from the command line.</li>
	</ul>

	<p>You can read the &#8220;and much much more&#8221; between the lines right?</p>

<object height="280" width="640"> 
<param name="movie" value="http://content.screencast.com/users/Jaykul/folders/Jing/media/5688481d-eb1e-4d47-b91b-31dc9584e465/jingswfplayer.swf" />
<param name="quality" value="high" /> 
<param name="bgcolor" value="#FFFFFF" />
<param name="flashVars" value="thumb=http://content.screencast.com/users/Jaykul/folders/Jing/media/5688481d-eb1e-4d47-b91b-31dc9584e465/FirstFrame.jpg&amp;width=640&amp;height=280&amp;content=http://content.screencast.com/users/Jaykul/folders/Jing/media/5688481d-eb1e-4d47-b91b-31dc9584e465/PowerBootsMonitoring.swf" />
<param name="allowFullScreen" value="true" /> 
<param name="scale" value="showall" />
<param name="allowScriptAccess" value="always" />
<param name="base" value="http://content.screencast.com/users/Jaykul/folders/Jing/media/5688481d-eb1e-4d47-b91b-31dc9584e465/" />  <embed src="http://content.screencast.com/users/Jaykul/folders/Jing/media/5688481d-eb1e-4d47-b91b-31dc9584e465/jingswfplayer.swf" quality="high" bgcolor="#FFFFFF" type="application/x-shockwave-flash" allowscriptaccess="always" flashvars="thumb=http://content.screencast.com/users/Jaykul/folders/Jing/media/5688481d-eb1e-4d47-b91b-31dc9584e465/FirstFrame.jpg&amp;width=640&amp;height=280&amp;content=http://content.screencast.com/users/Jaykul/folders/Jing/media/5688481d-eb1e-4d47-b91b-31dc9584e465/PowerBootsMonitoring.swf" allowfullscreen="true" base="http://content.screencast.com/users/Jaykul/folders/Jing/media/5688481d-eb1e-4d47-b91b-31dc9584e465/" scale="showall" height="280" width="640"></embed>
</object><span id="more-1045"></span>

	<h3>Breaking Changes and New Features</h3>

	<p>The big new thing in this release is that I&#8217;ve added a compiled module (PoshWpf) which contains several cmdlets, and gives us some major new functionality in exchange for a break in the syntax.  The syntax change is pretty simple, really, and the new threading functionality (and PowerShell 1.0 support for the cmdlets) is awesome (if I do say so myself)  <img src='http://huddledmasses.org/wordpress/wp-includes/' alt=':)' class='wp-smiley' /> .</p>

	<h4>New-BootsWindow replaces Out-Boots</h4>

	<p>New-BootsWindow is a compiled cmdlet, and in addition to all of the features already present in the now deprecated Out-Boots, it features a few important new features. Incidentally, I&#8217;ve actually left the old Out-Boots function in the code, just in case, but I&#8217;ve renamed it to Out-BootsWindow, and changed the &#8220;Boots&#8221; alias to point at the new New-BootsWindow.</p>

	<h5>ScriptBlock Content</h5>

	<p>The biggest change to your scripts is going to be a change from piping objects into Out-Boots, to creating your objects in a scriptblock parameter to New-BootsWindow. This allows the script to create the UI elements entirely within the new thread.  Since we&#8217;ve switched the &#8220;Boots&#8221; alias to point to New-BootsWindow, anything you used to write like this: <code> ... | Boots</code> you should now be able to write like this: <code>Boots { ... }</code> and get the same result. Additionally, to make the syntax of our little <span class="caps">DSL</span> just a little bit slicker, I now allow you to pass scriptblocks for just about everything (particularly for the main content parameters).  An example that looked like this, before:</p>

	<div class="posh code posh" style="font-family:monospace;"><br />
StackPanel <span style="color: #000066;">-Margin</span> <span style="color: #cc66cc;">10</span> <span style="color: #000066;">-Children</span> $<span style="color: #333;">&#40;</span><br />
&nbsp; &nbsp;TextBlock <span style="color: #009900;">&quot;The Question&quot;</span> <span style="color: #000066;">-FontSize</span> <span style="color: #cc66cc;">42</span> <span style="color: #000066;">-FontWeight</span> Bold <span style="color: #000066;">-Foreground</span> <span style="color: #009900;">&quot;#FF0088&quot;</span><br />
&nbsp; &nbsp;TextBlock <span style="color: #000066;">-FontSize</span> <span style="color: #cc66cc;">24</span> <span style="color: #000066;">-Inlines</span> $<span style="color: #333;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; Hyperlink $<span style="color: #333;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Bold <span style="color: #009900;">&quot;Q. &quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;">&quot;Can PowerBoots do async threads?&quot;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #333;">&#41;</span> <span style="color: #000066;">-NavigateUri</span> <span style="color: #009900;">&quot;_&quot;</span> <span style="color: #000066;">-On_RequestNavigate</span> <span style="color: #333;">&#123;</span> <span style="color: #660033; font-weight: bold;">$global</span>:Answer<span style="color: #333;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #333;">&#93;</span>.<span style="color: #003366;">Visibility</span> <span style="color: #66cc66;">=</span> <span style="color: #009900;">&quot;Visible&quot;</span> <span style="color: #333;">&#125;</span><br />
&nbsp; &nbsp;<span style="color: #333;">&#41;</span><br />
&nbsp; &nbsp;TextBlock <span style="color: #000066;">-FontSize</span> <span style="color: #cc66cc;">16</span> <span style="color: #000066;">-Inlines</span> $<span style="color: #333;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; Span <span style="color: #000066;">-FontSize</span> <span style="color: #cc66cc;">24</span> <span style="color: #000066;">-FontWeight</span> Bold <span style="color: #000066;">-Inlines</span> <span style="color: #009900;">&quot;A. &quot;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&quot;Not this way!&quot;</span><br />
&nbsp; &nbsp;<span style="color: #333;">&#41;</span> <span style="color: #000066;">-OV</span> global:Answer <span style="color: #000066;">-Visibility</span> Collapsed<br />
<span style="color: #333;">&#41;</span> <span style="color: #66cc66;">|</span> <span style="color: #0066cc; font-style: italic;">Out-<span style="font-style: normal;">BootsWindow</span></span> </div>

	<p>Can actually end up like this, now (and produce the same output):</p>

	<div class="posh code posh" style="font-family:monospace;"><br />
Boots <span style="color: #333;">&#123;</span><br />
&nbsp; &nbsp;StackPanel <span style="color: #000066;">-Margin</span> <span style="color: #cc66cc;">10</span> <span style="color: #333;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; TextBlock <span style="color: #009900;">&quot;The Question&quot;</span> <span style="color: #000066;">-FontSize</span> <span style="color: #cc66cc;">42</span> <span style="color: #000066;">-FontWeight</span> Bold <span style="color: #000066;">-Foreground</span> <span style="color: #009900;">&quot;#FF0088&quot;</span><br />
&nbsp; &nbsp; &nbsp; TextBlock <span style="color: #000066;">-FontSize</span> <span style="color: #cc66cc;">24</span> <span style="color: #333;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Hyperlink <span style="color: #333;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Bold <span style="color: #009900;">&quot;Q. &quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&quot;Can PowerBoots do async threads?&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #333;">&#125;</span> <span style="color: #000066;">-NavigateUri</span> <span style="color: #009900;">&quot; &quot;</span> <span style="color: #000066;">-On_RequestNavigate</span> <span style="color: #333;">&#123;</span> <span style="color: #660033; font-weight: bold;">$global</span>:Answer<span style="color: #333;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #333;">&#93;</span>.<span style="color: #003366;">Visibility</span> <span style="color: #66cc66;">=</span> <span style="color: #009900;">&quot;Visible&quot;</span> <span style="color: #333;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #333;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; TextBlock <span style="color: #000066;">-FontSize</span> <span style="color: #cc66cc;">16</span> <span style="color: #333;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Span <span style="color: #009900;">&quot;A. &quot;</span> <span style="color: #000066;">-FontSize</span> <span style="color: #cc66cc;">24</span> <span style="color: #000066;">-FontWeight</span> Bold <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;">&quot;Oh yes we can!&quot;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #333;">&#125;</span> <span style="color: #000066;">-OV</span> global:Answer <span style="color: #000066;">-Visibility</span> Collapsed<br />
&nbsp; &nbsp;<span style="color: #333;">&#125;</span><br />
<span style="color: #333;">&#125;</span> </div>

	<h5>The Async Parameter</h5>

	<p>If you specify <code>-Async</code>, the new popup window is spawned in a new thread, and all of it&#8217;s events etc. are handled on that separate thread.  This is actually what happens anyway when you run New-BootsWindow from a host that&#8217;s not running in <code>STA</code> mode, but if you don&#8217;t specify -Async, we fake the synchronous result so that you can use <code>Write-Output</code> within a dialog to prompt and get a result &#8220;returned&#8221; from New-BootsWindow. The cool thing about <code>-Async</code> is that not only can you continue using your console, you can run additional windows, and you can even use the new <code>Invoke-BootsWindow</code> cmdlet to run scripts within that window&#8217;s thread so you can change the <span class="caps">GUI</span> content, etc.</p>

	<h5>The Passthru Parameter</h5>

	<p>The <code>-Passthru</code> parameter causes the New-BootsWindow to output the window object that it has created to the pipeline.  It&#8217;s really only useful when you also specify the <code>-Async</code> parameter, since otherwise the window will be closed before you can use it.  Furthermore, because it&#8217;s a UI element, you can&#8217;t really do very much directly on the Window object without the use of our other cmdlets</p>

	<h4>The BootsWindow Collection</h4>

	<p>When you create a New-BootsWindow, the PowerBoots module (or snapin, for v1 users) tracks the window for you, so you can get ahold of it again later to run scripts against it, take screenshots, close it, etc.  To enable this we have three new cmdlets:</p>

	<ul>
		<li><code>Get-BootsWindow</code> returns the windows, and supports filtering by title or index.</li>
		<li><code>Remove-BootsWindow</code> will clear the list of windows that have already been closed, when called without parameters, or will close (and remove) windows that are still running if you pass a specific window, index, or window title.</li>
		<li><code>Invoke-BootsWindow</code> lets you run scriptblocks in a specific window&#8217;s thread</li>
	</ul>
	<ul>
		<li><code>Export-BootsImage</code> lets you take a screen capture of the contents of a window (or of a specific control)</li>
	</ul>

	<h4>Add and Remove Templates</h4>

	<p>There are three new cmdlets for managing <span class="caps">XAML</span> source files.  Add, Remove, and Get BootsTemplate. These allow you to specify additional <span class="caps">XAML</span> files (beyond the default.xaml), and those templates are always automatically loaded into each new window, so you can specify styles, resources, data templates and even new <span class="caps">WPF</span> Templates (I&#8217;ll throw up an example using the ones from <a href="http://WpfThemes.CodePlex.com"><span class="caps">WPF</span> Themes</a> later this weekend).</p>

	<h2>Download and Source now hosted on CodePlex</h2>

	<p>Well, that&#8217;s enough for the highlights for now. I&#8217;ve included the first blush efforts of a ps1xml format and data types files (which get loaded automatically with the module on PowerShell 2, but not v1), and I haven&#8217;t yet written up the help files for the compiled cmdlets.  Look for more help and examples and maybe even some cleaned up sample videos over the weekend. Please file any problems you have as bugs on <a href="http://boots.codeplex.com">Boots.CodePlex.com</a>, where you can find the <a href="http://boots.codeplex.com/Release/ProjectReleases.aspx">latest release</a>.</p>

	<p>I do want to point out that I&#8217;ve left the version number at 0.1 &#8230; I really want to add some explicit support for attached properties, and I&#8217;m sure I&#8217;ve missed a bug or two somewhere along the line  <img src='http://huddledmasses.org/wordpress/wp-includes/' alt=';)' class='wp-smiley' />  lets consider this another <strong>solid</strong> beta release.</p>

<div class="zemanta-pixie"><a class="zemanta-pixie-a" href="http://reblog.zemanta.com/zemified/0b00377a-7c0c-4703-abb8-4effc7afedbd/" title="Zemified by Zemanta"><img class="zemanta-pixie-img" src="http://img.zemanta.com/reblog_e.png?x-id=0b00377a-7c0c-4703-abb8-4effc7afedbd" alt="Reblog this post [with Zemanta]" /></a></div>]]></content:encoded>
			<wfw:commentRss>http://huddledmasses.org/powerboots-now-multi-threaded/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PowerBoots &#8211; Output Graphs to Images from PowerShell</title>
		<link>http://huddledmasses.org/powerboots-output-graphs-to-images-from-powershell/</link>
		<comments>http://huddledmasses.org/powerboots-output-graphs-to-images-from-powershell/#comments</comments>
		<pubDate>Fri, 16 Jan 2009 06:01:08 +0000</pubDate>
		<dc:creator>Joel 'Jaykul' Bennett</dc:creator>
				<category><![CDATA[Huddled]]></category>
		<category><![CDATA[Charting]]></category>
		<category><![CDATA[Charts]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[PowerBoots]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Visifire]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://huddledmasses.org/?p=1019</guid>
		<description><![CDATA[Once I started playing with the new ability, introduced in PowerBoots 0.0.4 to easily add support for new graphical controls to PowerBoots, I found all sorts of fun widgets out there in open-source land. I&#8217;ll write about a few of them in the future, but for now I&#8217;m just going to stick with Visifire. After [...]]]></description>
			<content:encoded><![CDATA[	<p>Once I started playing with the new ability, introduced in <a href="http://huddledmasses.org/PowerBoots/">PowerBoots</a> 0.0.4 to easily add support for new graphical controls to PowerBoots, I found all sorts of fun widgets out there in open-source land.  I&#8217;ll write about a few of them in the future, but for now I&#8217;m just going to stick with Visifire.  After playing with a few examples, I finally got around to actually trying to create the graphs I needed at work which were the main source of motivation for trying to do Visifire from PowerShell anyway &#8230;</p>

	<p>The problem was, half of the need we have for graphs is to throw them up on a web-server &#8230; so I needed a way to take the <span class="caps">WPF</span> window, and capture the controls and visuals as an image. Basically, render the <span class="caps">WPF</span> control to a bitmap image, instead of to the screen.  To cut a long story short, I figured it out of course &#8212; why else would I be writing this? (<a href="http://huddledmasses.org/PowerBoots/">get it here</a>).</p>

	<h2>Out-BootsImage</h2>

	<p>So the new version of PowerBoots includes the Out-BootsImage function (aliased as BootsImage and &#8220;obi&#8221;), which basically is designed to take the filename of an image, and a boots visual element, and create a screenshot.  It can generate bmp, gif, jpg, png, tiff, and even Microsoft&#8217;s new <a href="http://www.microsoft.com/windows/windowsmedia/wmphoto" title="HD Photo">wdp</a> format, or it can output to clipboard.</p>

	<p><img src="http://huddledmasses.org/images/PowerBoots/VisiFire-BootsImage.jpg" align="right" alt="" width="200" height="150" /></p>

	<p>It&#8217;s late, so I&#8217;m not going to write any more about this &#8230; the bottom line is, if you have been looking for a (free) way to generate graphs and charts to image files in PowerShell, this will work for you: go grab <a href="http://www.visifire.com/">Visifire</a>, check out their <a href="http://www.visifire.com/silverlight_charts_gallery.php">gallery</a> for inspiration, and start churning out graphs! Just for fun, here are the samples from the help documentation (except, this is the actual script I ran, including the upload code) with screen-shots &#8230;  </p>

	<h3>Important note</h3>

	<p>When producing images of Visifire charts using this method, it is absolutely critical that <strong>you must specify <code>-Animation $false</code></strong> because otherwise you will consistenly produce images of empty charts (since by default Visifire animates all of the bars onto the screen right <em>after</em> the <code>SourceInitialized</code> event that I use to capture the image). Oh, and if you need to remove the Visifire.com watermark, there is a <code>-watermark $false</code> parameter on the <code>Chart</code> element, which turns it off.</p>

	<p><img src="http://huddledmasses.org/images/PowerBoots/VisiFire-OutImage.jpg" alt="" width="200" height="150" /></p>

	<div class="posh code posh" style="font-family:monospace;"><br />
<span style="color: #660033; font-weight: bold;">$credential</span> <span style="color: #66cc66;">=</span> <span style="color: #0066cc; font-style: italic;">Get-<span style="font-style: normal;">Credential</span></span><br />
<br />
Chart <span style="color: #000066;">-Width</span> <span style="color: #cc66cc;">200</span> <span style="color: #000066;">-Height</span> <span style="color: #cc66cc;">150</span> <span style="color: #000066;">-Theme</span> Theme3 <span style="color: #000066;">-Watermark</span> <span style="color: #660033; font-weight: bold;">$false</span> <span style="color: #000066;">-Animation</span> <span style="color: #660033; font-weight: bold;">$false</span> <span style="color: #333;">&#40;</span><br />
&nbsp; &nbsp;DataSeries $<span style="color: #333;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; 1..<span style="color: #333;">&#40;</span><span style="color: #0066cc; font-style: italic;">Get-<span style="font-style: normal;">Random</span></span> <span style="color: #000066;">-min</span> <span style="color: #cc66cc;">3</span> <span style="color: #000066;">-max</span> <span style="color: #cc66cc;">6</span><span style="color: #333;">&#41;</span> <span style="color: #66cc66;">|</span> ForEach<span style="color: #66cc66;">-</span>Object &nbsp;<span style="color: #333;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;DataPoint <span style="color: #000066;">-YValue</span> <span style="color: #333;">&#40;</span><span style="color: #0066cc; font-style: italic;">Get-<span style="font-style: normal;">Random</span></span> <span style="color: #cc66cc;">100</span><span style="color: #333;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #333;">&#125;</span><br />
&nbsp; &nbsp;<span style="color: #333;">&#41;</span><br />
<span style="color: #333;">&#41;</span> <span style="color: #66cc66;">|</span> <span style="color: #0066cc; font-style: italic;">Out-<span style="font-style: normal;">BootsImage</span></span> VisiFire<span style="color: #66cc66;">-</span>BootsImage.<span style="color: #003366;">jpg</span> <span style="color: #66cc66;">|</span>ForEach<span style="color: #66cc66;">-</span>Object <span style="color: #333;">&#123;</span> <br />
&nbsp; &nbsp;<span style="color: #0066cc; font-style: italic;">Send-<span style="font-style: normal;">FTP</span></span> HuddledMasses.<span style="color: #003366;">org</span> <span style="color: #660033; font-weight: bold;">$credential</span> <span style="color: #000066;">-LocalFile</span> <span style="color: #660033; font-weight: bold;">$_</span> <span style="color: #000066;">-Remotefile</span> <span style="color: #009900;">&quot;$imgPath/$($_.Name)&quot;</span> <br />
&nbsp; &nbsp;<span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span>Windows.<span style="color: #003366;">Clipboard</span><span style="color: #333;">&#93;</span></span>::<span style="color: #003366;">SetText</span><span style="color: #333;">&#40;</span> <span style="color: #009900;">&quot;!http://huddledmasses.org/images/PowerBoots/$($_.Name)!&quot;</span> <span style="color: #333;">&#41;</span><br />
<span style="color: #333;">&#125;</span><br />
<br />
StackPanel <span style="color: #000066;">-Margin</span> <span style="color: #009900;">&quot;10,5,10,5&quot;</span> $<span style="color: #333;">&#40;</span> <br />
&nbsp; &nbsp;Label <span style="color: #009900;">&quot;Please enter your name:&quot;</span><br />
&nbsp; &nbsp;StackPanel <span style="color: #000066;">-Orientation</span> Horizontal $<span style="color: #333;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; TextBox <span style="color: #000066;">-OutVariable</span> global:textbox <span style="color: #000066;">-Width</span> <span style="color: #cc66cc;">150</span> <span style="color: #000066;">-On_KeyDown</span> <span style="color: #333;">&#123;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #666699; font-weight: bold;">if</span><span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$_</span>.<span style="color: #003366;">Key</span> <span style="color: #000066;">-eq</span> <span style="color: #009900;">&quot;Return&quot;</span><span style="color: #333;">&#41;</span> <span style="color: #333;">&#123;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066cc; font-style: italic;">Write-<span style="font-style: normal;">Output</span></span> <span style="color: #660033; font-weight: bold;">$textbox</span><span style="color: #333;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #333;">&#93;</span>.<span style="color: #003366;">Text</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #660033; font-weight: bold;">$BootsWindow</span>.<span style="color: #003366;">Close</span><span style="color: #333;">&#40;</span><span style="color: #333;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #333;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #333;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; Button <span style="color: #009900;">&quot;Ok&quot;</span> <span style="color: #000066;">-Padding</span> <span style="color: #009900;">&quot;5,0,5,0&quot;</span> <span style="color: #000066;">-Margin</span> <span style="color: #009900;">&quot;2,0,0,0&quot;</span> <span style="color: #000066;">-On_Click</span> <span style="color: #333;">&#123;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0066cc; font-style: italic;">Write-<span style="font-style: normal;">Output</span></span> <span style="color: #660033; font-weight: bold;">$textbox</span><span style="color: #333;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #333;">&#93;</span>.<span style="color: #003366;">Text</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #660033; font-weight: bold;">$BootsWindow</span>.<span style="color: #003366;">Close</span><span style="color: #333;">&#40;</span><span style="color: #333;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #333;">&#125;</span><br />
&nbsp; &nbsp;<span style="color: #333;">&#41;</span><br />
<span style="color: #333;">&#41;</span> <span style="color: #66cc66;">|</span> <span style="color: #0066cc; font-style: italic;">Out-<span style="font-style: normal;">BootsImage</span></span> BootsImage<span style="color: #66cc66;">-</span>Screenshot.<span style="color: #003366;">jpg</span> <span style="color: #66cc66;">|</span> ForEach<span style="color: #66cc66;">-</span>Object <span style="color: #333;">&#123;</span> <br />
&nbsp; &nbsp;<span style="color: #0066cc; font-style: italic;">Send-<span style="font-style: normal;">FTP</span></span> HuddledMasses.<span style="color: #003366;">org</span> <span style="color: #660033; font-weight: bold;">$credential</span> <span style="color: #000066;">-LocalFile</span> <span style="color: #660033; font-weight: bold;">$_</span> <span style="color: #000066;">-Remotefile</span> <span style="color: #009900;">&quot;$imgPath/$($_.Name)&quot;</span> <br />
&nbsp; &nbsp;<span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span>Windows.<span style="color: #003366;">Clipboard</span><span style="color: #333;">&#93;</span></span>::<span style="color: #003366;">SetText</span><span style="color: #333;">&#40;</span> <span style="color: #009900;">&quot;!http://huddledmasses.org/images/PowerBoots/$($_.Name)!&quot;</span> <span style="color: #333;">&#41;</span><br />
<span style="color: #333;">&#125;</span><br />
&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://huddledmasses.org/powerboots-output-graphs-to-images-from-powershell/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PowerBoots 0.0.4 &#8211; Tab Completion &#8211; Visifire</title>
		<link>http://huddledmasses.org/powerboots-tab-completion-visifire/</link>
		<comments>http://huddledmasses.org/powerboots-tab-completion-visifire/#comments</comments>
		<pubDate>Thu, 15 Jan 2009 03:47:25 +0000</pubDate>
		<dc:creator>Joel 'Jaykul' Bennett</dc:creator>
				<category><![CDATA[Huddled]]></category>
		<category><![CDATA[Charts]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[PowerBoots]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Visifire]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://huddledmasses.org/?p=1008</guid>
		<description><![CDATA[This is the fourth release of the PowerBoots module for PowerShell 2 (Download &#8211; 7z). PowerBoots is a framework for creating WPF GUIs from PowerShell, and this latest release brings a couple of bug fixes and two new features. Now with tab completion The biggest change in PowerBoots 0.0.4 is that tab-completion for parameters works [...]]]></description>
			<content:encoded><![CDATA[	<p>This is the fourth release of the <a href="http://huddledmasses.org/powerboots/">PowerBoots module</a> for PowerShell 2 (<a href="http://HuddledMasses.org/downloads/PowerBoots/PowerBoots.0.0.4.0.zip">Download</a> &#8211; <a href="http://HuddledMasses.org/downloads/PowerBoots/PowerBoots.0.0.4.0.7z">7z</a>).  PowerBoots is a framework for creating <span class="caps">WPF</span> GUIs from PowerShell, and this latest release brings a couple of bug fixes and two new features.</p>

	<h3>Now with tab completion</h3>

	<p>The biggest change in PowerBoots 0.0.4 is that tab-completion for parameters works in the shell. </p>

	<p class="dem1">Behind the scenes what has happened is that I&#8217;ve discovered that in the current CTP3 release of PowerShell 2, Dynamic Parameter sets are not handled correctly for aliases, and the Get-Command for aliases of functions doesn&#8217;t return the same set of parameters as it does on the function itself.  The result is that Tab-Completion for dynamic parameters doesn&#8217;t work on aliases (neither the built-in tab completion, nor <a href="http://thepowershellguy.com/blogs/posh/pages/powertab-v2-alpha-1.aspx">MoW&#8217;s PowerTab</a>).  I <a href="https://connect.microsoft.com/feedback/ViewFeedback.aspx?FeedbackID=397832&#38;SiteID=99" title="please vote">wrote up a bug</a> against that, but I also found that I can work around it by creating hundreds of functions (all pointed at the same script-block), instead of hundreds of aliases (all pointed at the same function).</p>

	<h4>PowerBoots produces functions instead aliases</h4>

	<p>This means the PowerBoots commands show up by default when you run Get-Command. Incidentally, this means that the <em>first</em> time you run Get-Command after you <code>Import-Module PowerBoots</code> you incur a huge penalty (17 seconds on my machine) while Get-Command caches all the dynamic parameter information about the functions. <strong>NOTE:</strong> because of the DynamicParam bug, I&#8217;ve ditched aliases altogether for this particular project and am generating two functions for each element/type in PowerBoots: the full New-Namespace.Type version, and a &#8220;Type&#8221; alias when possible.  Trust me when I say: &#8220;it&#8217;s worth it&#8221; ... with the backing scriptblock, there&#8217;s virtually no difference between the two approches in terms of resources (other than the aforementions hit on Get-Command).</p>

	<h3>Now with more controls</h3>

	<p>The second big change (and the one which I hope will have the biggest long-term impact) is that you can now import your own <span class="caps">WPF</span> control libraries into PowerBoots. This means that you can, for example, go get the open source <a href="http://www.visifire.com/">Visifire</a> charting library, extract their WPFVisifire.Charts library into your PowerShell folder, and use it like so: </p>

	<div class="posh code posh" style="font-family:monospace;"><br />
<span style="color: #0066cc; font-style: italic;">Add-<span style="font-style: normal;">BootsContentProperty</span></span> <span style="color: #009900;">'DataPoints'</span>, <span style="color: #009900;">'Series'</span><br />
<span style="color: #0066cc; font-style: italic;">Add-<span style="font-style: normal;">BootsFunction</span></span> <span style="color: #000066;">-Assembly</span> <span style="color: #009900;">&quot;~\Documents\WindowsPowershell\Libraries\WPFVisifire.Charts.dll&quot;</span><br />
<br />
Chart <span style="color: #000066;">-Width</span> <span style="color: #cc66cc;">200</span> <span style="color: #000066;">-Height</span> <span style="color: #cc66cc;">150</span> <span style="color: #000066;">-Theme</span> Theme3 <span style="color: #333;">&#40;</span><br />
&nbsp; DataSeries $<span style="color: #333;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; DataPoint <span style="color: #000066;">-YValue</span> <span style="color: #333;">&#40;</span><span style="color: #0066cc; font-style: italic;">Get-<span style="font-style: normal;">Random</span></span> <span style="color: #cc66cc;">100</span><span style="color: #333;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; DataPoint <span style="color: #000066;">-YValue</span> <span style="color: #333;">&#40;</span><span style="color: #0066cc; font-style: italic;">Get-<span style="font-style: normal;">Random</span></span> <span style="color: #cc66cc;">100</span><span style="color: #333;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; DataPoint <span style="color: #000066;">-YValue</span> <span style="color: #333;">&#40;</span><span style="color: #0066cc; font-style: italic;">Get-<span style="font-style: normal;">Random</span></span> <span style="color: #cc66cc;">100</span><span style="color: #333;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; DataPoint <span style="color: #000066;">-YValue</span> <span style="color: #333;">&#40;</span><span style="color: #0066cc; font-style: italic;">Get-<span style="font-style: normal;">Random</span></span> <span style="color: #cc66cc;">100</span><span style="color: #333;">&#41;</span><br />
&nbsp; <span style="color: #333;">&#41;</span><br />
<span style="color: #333;">&#41;</span> <span style="color: #66cc66;">|</span> Boots <span style="color: #000066;">-Title</span> <span style="color: #009900;">&quot;Sample, Theme 3&quot;</span><br />
&nbsp;</div>

<span id="more-1008"></span>

	<p><img src="http://huddledmasses.org/images/PowerBoots/Visifire3.png" align="right" alt="" width="230" height="206" /></p>

	<p>The main thing required to add new types to PowerBoots is to call Add-BootsFunction and pass it a Type or an Assembly &#8230; however, in order to get the nice clean syntax, and pipeline support for the &#8220;content&#8221; property (without having to specify the parameter name), we have to know which properties should be the default. PowerBoots has special handling for &#8216;Content&#8217;, &#8216;Child&#8217;, &#8216;Children&#8217;, &#8216;Items&#8217;, &#8216;Blocks&#8217; and &#8216;Inlines&#8217; which are the properties used by the various content models of the built-in <span class="caps">WPF</span> controls. I also added &#8216;GradientStops&#8217; to make it easier to work with the GradientBrushes. But Visifire (and other third-party controls) may not follow this very well, so in order to get the simple syntax for Visifire that you see here, I modified PowerBoots so that &#8216;DataPoints&#8217; and &#8216;Series&#8217; would be added as Content properties.  </p>

	<p><img src="http://huddledmasses.org/images/PowerBoots/Visifire2.png" align="left" alt="" width="232" height="208" /></p>

	<p>Now, I&#8217;ve added functions to allow you to Get, Add, or Remove from the collection of these default property names &#8230; so you can call <code>Add-BootsContentProperty</code> to add to the list of property names which should be treated as default properties.  You can also list them, and remove from the list. You should use these features with care, because if you have two default properties on the same object, you&#8217;ll probably have problems.  <img src='http://huddledmasses.org/wordpress/wp-includes/' alt=';)' class='wp-smiley' />   There&#8217;s no need to worry about adding duplicate names though, so if you want to write a PowerBoots-based module to, say, make charting easier &#8230; you could just require PowerBoots, and then call <code>Add-BootsContentProperty</code> and add the types you wanted functions for &#8230; and <strong>then</strong> add your customized functions.</p>

	<h2>Visifire &#8230; Slick Charting!</h2>

	<p>I&#8217;ve been meaning to write a whole post dedicated to Visifire and what it can do &#8212; even the screenshots you&#8217;re seeing here don&#8217;t really do it justice. It has very nice configureable mouse-over tooltips, all the chart elements are interactive, you can add hyperlinks to data points, or manually handle events like MouseEnter, and MouseDown/Up/Click with a simple scriptblock, and you can even add context menus, text input, etc.  <img src="http://huddledmasses.org/images/PowerBoots/Visifire-BootsIsNew.png" align="right" alt="" width="176" height="194" /> There&#8217;s a <a href="http://www.visifire.com/silverlight_charts_gallery.php">really good silverlight graph gallery</a> on their site &#8212; pretty much anything you see there, you can do in Visifire &#8212; And now, you can do it all from PowerShell, easily.  This is actually why I&#8217;ve been holding off writing about it, because their default syntax is a bit of a pain to work with, especially from PowerShell, with all the <code>New-Object</code> calls, over and over.</p>

	<p>PowerBoots makes working with Visifire charts from PowerShell <strong>much</strong> easier, but you still have to specifically create the DataSeries and DataPoints, even if you don&#8217;t want to specify any parameters for them.  If I keep using the Visifire stuff, I&#8217;ll eventually have to create a New-DataSeries function along the lines of Select-Object: taking a hashtable to define the values for the DataPoint, like <code>ls | New-DataSeries @{YValue={$_.Length}; AxisXLabel={$_.Name}}</code> or something.  In the meantime, to create the graph on the right, you need to do something like this:</p>

	<div class="posh code posh" style="font-family:monospace;"><br />
<span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span><span style="color: #003366; font-weight: bold;">int</span><span style="color: #333;">&#93;</span></span><span style="color: #660033; font-weight: bold;">$tk</span> &nbsp; &nbsp;<span style="color: #66cc66;">=</span> <span style="color: #0066cc; font-style: italic;">Invoke-<span style="font-style: normal;">Http</span></span> get http:<span style="color: #66cc66;">//</span>google.<span style="color: #003366;">com</span><span style="color: #66cc66;">/</span>search <span style="color: #000066;">-with</span> @<span style="color: #333;">&#123;</span>q<span style="color: #66cc66;">=</span><span style="color: #009900;">&quot;TCL Tk&quot;</span><span style="color: #333;">&#125;</span> <span style="color: #66cc66;">|</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066cc; font-style: italic;">Receive-<span style="font-style: normal;">Http</span></span> Text <span style="color: #009900;">&quot;//div[@id='ssb']//b[3]&quot;</span><br />
<span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span><span style="color: #003366; font-weight: bold;">int</span><span style="color: #333;">&#93;</span></span><span style="color: #660033; font-weight: bold;">$shoes</span> <span style="color: #66cc66;">=</span> <span style="color: #0066cc; font-style: italic;">Invoke-<span style="font-style: normal;">Http</span></span> get http:<span style="color: #66cc66;">//</span>google.<span style="color: #003366;">com</span><span style="color: #66cc66;">/</span>search <span style="color: #000066;">-with</span> @<span style="color: #333;">&#123;</span>q<span style="color: #66cc66;">=</span><span style="color: #009900;">&quot;Ruby Shoes&quot;</span><span style="color: #333;">&#125;</span> <span style="color: #66cc66;">|</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066cc; font-style: italic;">Receive-<span style="font-style: normal;">Http</span></span> Text <span style="color: #009900;">&quot;//div[@id='ssb']//b[3]&quot;</span><br />
<span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span><span style="color: #003366; font-weight: bold;">int</span><span style="color: #333;">&#93;</span></span><span style="color: #660033; font-weight: bold;">$boots</span> <span style="color: #66cc66;">=</span> <span style="color: #0066cc; font-style: italic;">Invoke-<span style="font-style: normal;">Http</span></span> get http:<span style="color: #66cc66;">//</span>google.<span style="color: #003366;">com</span><span style="color: #66cc66;">/</span>search <span style="color: #000066;">-with</span> @<span style="color: #333;">&#123;</span>q<span style="color: #66cc66;">=</span><span style="color: #009900;">&quot;PowerShell PowerBoots&quot;</span><span style="color: #333;">&#125;</span> <span style="color: #66cc66;">|</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066cc; font-style: italic;">Receive-<span style="font-style: normal;">Http</span></span> Text <span style="color: #009900;">&quot;//div[@id='ssb']//b[3]&quot;</span><br />
<br />
Chart <span style="color: #000066;">-MinHeight</span> <span style="color: #cc66cc;">100</span> <span style="color: #000066;">-MinWidth</span> <span style="color: #cc66cc;">100</span> <span style="color: #333;">&#40;</span><br />
&nbsp; &nbsp;DataSeries <span style="color: #000066;">-RenderAs</span> Bar $<span style="color: #333;">&#40;</span> <br />
&nbsp; &nbsp; &nbsp; DataPoint <span style="color: #000066;">-YValue</span> <span style="color: #660033; font-weight: bold;">$tk</span> &nbsp; &nbsp;<span style="color: #000066;">-AxisXLabel</span> Tk &nbsp; &nbsp;<span style="color: #000066;">-Href</span> http:<span style="color: #66cc66;">//</span>google.<span style="color: #003366;">com</span><span style="color: #66cc66;">/</span>search?q<span style="color: #66cc66;">=</span>TCL<span style="color: #66cc66;">+</span>Tk<br />
&nbsp; &nbsp; &nbsp; DataPoint <span style="color: #000066;">-YValue</span> <span style="color: #660033; font-weight: bold;">$shoes</span> <span style="color: #000066;">-AxisXLabel</span> Shoes <span style="color: #000066;">-Href</span> http:<span style="color: #66cc66;">//</span>google.<span style="color: #003366;">com</span><span style="color: #66cc66;">/</span>search?q<span style="color: #66cc66;">=</span>Ruby<span style="color: #66cc66;">+</span>Shoes<br />
&nbsp; &nbsp; &nbsp; DataPoint <span style="color: #000066;">-YValue</span> <span style="color: #660033; font-weight: bold;">$boots</span> <span style="color: #000066;">-AxisXLabel</span> Boots <span style="color: #000066;">-Href</span> http:<span style="color: #66cc66;">//</span>google.<span style="color: #003366;">com</span><span style="color: #66cc66;">/</span>search?q<span style="color: #66cc66;">=</span><span style="color: #003366; font-weight: bold;">PowerSHell</span><span style="color: #66cc66;">+</span>PowerBoots<br />
&nbsp; &nbsp;<span style="color: #333;">&#41;</span><br />
<span style="color: #333;">&#41;</span> <span style="color: #66cc66;">|</span> Boots<br />
&nbsp;</div>

	<p>The Invoke-Http and Receive-Http commands here are courtesy of <a href="http://poshcode.org/787">HttpRest</a>, and in this case, the XPath I&#8217;m using returns the total number of hits on Google for each search term&#8230;</p>

	<h4>What sorts of graphs and charts do you need?</h4>

	<p>Obviously Visifire lets you create all sorts of charts.  Everything from stock tracking, to computer uptimes, to file sizes &#8230; I&#8217;ve got a few examples here, but really I need a few more real-world ones.</p>

	<h4>How about a graph of your active directory structure?</h4>

	<p>We can show the number of users at each location (or in each group, or whatever) fairly easily from ActiveDirectory.  The interesting thing about this task, however, is that it lends itself to piping the data, instead of getting the data inside. If you don&#8217;t like this syntax (it <em>is</em> a little harder to read, I think) you can always write the whole AD stuff inside a $(evaluation) block for the content (the <code>-DataPoints</code> parameter) of the DataSeries function.</p>

	<p><img src="http://huddledmasses.org/images/PowerBoots/Visifire-Doughnut.png" alt="" width="332" height="354" /></p>

	<div class="posh code posh" style="font-family:monospace;"><br />
<span style="color: #660033; font-weight: bold;">$ad</span><span style="color: #66cc66;">=</span><span style="color: #0066cc; font-style: italic;">New-<span style="font-style: normal;">Object</span></span> DirectoryServices.<span style="color: #003366;">DirectorySearcher</span> <span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span><span style="color: #003366; font-weight: bold;">ADSI</span><span style="color: #333;">&#93;</span></span><span style="color: #009900;">''</span><br />
<span style="color: #666666; font-style: italic;"># Set a limit or TimeOut, PageSize lets us get more later</span><br />
<span style="color: #660033; font-weight: bold;">$ad</span>.<span style="color: #003366;">PageSize</span> <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">200</span><br />
<br />
<span style="color: #666666; font-style: italic;"># ADSI field names are awful.</span><br />
<span style="color: #666666; font-style: italic;"># l = location, l=* returns only users with locations set</span><br />
<span style="color: #660033; font-weight: bold;">$ad</span>.<span style="color: #666699; font-weight: bold;">Filter</span> <span style="color: #66cc66;">=</span> <span style="color: #009900;">&quot;(&amp;(objectClass=Person)(l=*))&quot;</span> &nbsp;<br />
<span style="color: #660033; font-weight: bold;">$results</span> <span style="color: #66cc66;">=</span> <span style="color: #660033; font-weight: bold;">$ad</span>.<span style="color: #003366;">FindAll</span><span style="color: #333;">&#40;</span><span style="color: #333;">&#41;</span>.<span style="color: #003366;">GetEnumerator</span><span style="color: #333;">&#40;</span><span style="color: #333;">&#41;</span> <span style="color: #66cc66;">|</span> <span style="color: #666699; font-weight: bold;">ForEach</span> <span style="color: #333;">&#123;</span> <span style="color: #660033; font-weight: bold;">$_</span> <span style="color: #333;">&#125;</span><br />
<span style="color: #660033; font-weight: bold;">$users</span> &nbsp; <span style="color: #66cc66;">=</span> <span style="color: #660033; font-weight: bold;">$results</span> <span style="color: #66cc66;">|</span> <span style="color: #666699; font-weight: bold;">ForEach</span> <span style="color: #333;">&#123;</span> <span style="color: #660033; font-weight: bold;">$_</span>.<span style="color: #003366;">GetDirectoryEntry</span><span style="color: #333;">&#40;</span><span style="color: #333;">&#41;</span> <span style="color: #333;">&#125;</span><br />
<br />
<span style="color: #666666; font-style: italic;"># &quot;l&quot; is a PropertyValueCollection, use the first value</span><br />
<span style="color: #660033; font-weight: bold;">$users</span> <span style="color: #66cc66;">|</span> <span style="color: #0066cc; font-style: italic;">Group-<span style="font-style: normal;">Object</span></span> <span style="color: #333;">&#123;</span><span style="color: #660033; font-weight: bold;">$_</span>.<span style="color: #003366;">l</span><span style="color: #333;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #333;">&#93;</span><span style="color: #333;">&#125;</span> &nbsp;<span style="color: #66cc66;">|</span> <span style="color: #666699; font-weight: bold;">ForEach</span> <span style="color: #333;">&#123;</span> <br />
&nbsp; &nbsp;DataPoint <span style="color: #000066;">-YValue</span> <span style="color: #333;">&#40;</span><span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span><span style="color: #003366; font-weight: bold;">int</span><span style="color: #333;">&#93;</span></span><span style="color: #660033; font-weight: bold;">$_</span>.<span style="color: #003366;">Count</span><span style="color: #333;">&#41;</span> <span style="color: #000066;">-AxisXLabel</span> <span style="color: #660033; font-weight: bold;">$_</span>.<span style="color: #003366;">Name</span> <br />
<span style="color: #333;">&#125;</span><span style="color: #66cc66;">|</span> DataSeries <span style="color: #000066;">-RenderAs</span> Doughnut <span style="color: #66cc66;">|</span> <br />
&nbsp; &nbsp;Chart <span style="color: #000066;">-Height</span> <span style="color: #cc66cc;">300</span> <span style="color: #000066;">-Width</span> <span style="color: #cc66cc;">300</span> &nbsp;<span style="color: #66cc66;">|</span> <br />
&nbsp; &nbsp;Boots <span style="color: #000066;">-Title</span> <span style="color: #009900;">&quot;AD Users by Location&quot;</span><br />
&nbsp;</div>

	<h4>Or perhaps a graph showing the relative age and size of the files in a directory &#8230;</h4>

	<p>Bubble charts are a bit more complicated, just because there&#8217;s more stuff to set.  You should really have a look at the <a href="http://www.visifire.com/learn_silverlight_charts.php">Visifire Documentation</a>, because there are a metric boatload of options and parameters, and a lot of the parameters that are present on the DataPoint element are only used for certain charts (like ZValue, which is only for bubble charts).  </p>

	<p>In this example I also set the ToolTip text so you can see how to do it, and I store the DataSeries so that I can remove things from it later on&#8230; thought that would be a useful example  <img src='http://huddledmasses.org/wordpress/wp-includes/' alt=':)' class='wp-smiley' />  </p>

	<p><img src="http://huddledmasses.org/images/PowerBoots/Visifire-Bubble.png" alt="" width="580" height="581" /></p>

	<p>We handle clicks by writing the selected objects out (in this case, to the Remove-Item cmdlet), and then removing them from the graph so they can&#8217;t be selected again. If you run this script an play with it, you&#8217;ll notice that VisiFire charts automatically redraw when you remove an item, so if you click on the largest file(s), the rest of the files bubbles will grow&#8230;</p>

	<div class="posh code posh" style="font-family:monospace;"><br />
<span style="color: #660033;">ls</span> <span style="color: #66cc66;">|</span> <span style="color: #666699; font-weight: bold;">ForEach</span> <span style="color: #333;">&#123;</span> <br />
&nbsp; &nbsp;DataPoint <span style="color: #000066;">-YValue</span> <span style="color: #333;">&#40;</span><span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span>DateTime<span style="color: #333;">&#93;</span></span>::<span style="color: #003366;">Now</span> <span style="color: #66cc66;">-</span> <span style="color: #660033; font-weight: bold;">$_</span>.<span style="color: #003366;">LastWriteTime</span><span style="color: #333;">&#41;</span>.<span style="color: #003366;">TotalDays</span> `<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">-ZValue</span> <span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$_</span>.<span style="color: #003366;">Length</span><span style="color: #66cc66;">/</span>1KB<span style="color: #333;">&#41;</span> `<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">-AxisXLabel</span> <span style="color: #660033; font-weight: bold;">$_</span>.<span style="color: #003366;">Name</span> <span style="color: #000066;">-Tag</span> <span style="color: #660033; font-weight: bold;">$_</span> `<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">-On_MouseLeftButtonUp</span> <span style="color: #333;">&#123;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #666699; font-weight: bold;">if</span><span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$this</span>.<span style="color: #003366;">Tag</span><span style="color: #333;">&#41;</span> <span style="color: #333;">&#123;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066cc; font-style: italic;">Write-<span style="font-style: normal;">Output</span></span> <span style="color: #660033; font-weight: bold;">$this</span>.<span style="color: #003366;">Tag</span>; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #660033; font-weight: bold;">$series</span><span style="color: #333;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #333;">&#93;</span>.<span style="color: #003366;">DataPoints</span>.<span style="color: #003366;">Remove</span><span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$this</span><span style="color: #333;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #333;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #333;">&#125;</span><br />
<span style="color: #333;">&#125;</span> <span style="color: #66cc66;">|</span> DataSeries <span style="color: #000066;">-RenderAs</span> Bubble <span style="color: #000066;">-OutVariable</span> series `<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">-ToolTipText</span> <span style="color: #009900;">&quot;#AxisXLabel<span style="color: #000099; font-weight: bold;">`n</span>Age: #YValue days, Size: #ZValue Kb&quot;</span> <span style="color: #66cc66;">|</span> <br />
&nbsp; &nbsp;Chart <span style="color: #000066;">-MinHeight</span> <span style="color: #cc66cc;">250</span> <span style="color: #000066;">-MinWidth</span> <span style="color: #cc66cc;">500</span> <span style="color: #000066;">-Theme</span> Theme3 <span style="color: #66cc66;">|</span> Boots <span style="color: #66cc66;">|</span> <span style="color: #0066cc; font-style: italic;">Remove-<span style="font-style: normal;">Item</span></span> <span style="color: #000066;">-Confirm</span><br />
&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://huddledmasses.org/powerboots-tab-completion-visifire/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

