Tome's Land of IT

IT Notes from the Powertoe – Tome Tanasovski

PrimalForms 2011 – Sneak Peek

One of the most anticipated releases in the Powershell community this year is the new version of PrimalForms that is due to be released early in 2011. If you have ever needed to create a GUI front-end for a PowerShell script you have definitely seen or tried PrimalForms or the free PrimalForms community edition. While the PowerShellPack released by Microsoft gives you a nice way to work with WPK, it is cumbersome and can be difficult to figure out. Actually, creating any GUI by hand without a visual guide can be an absolute nightmare. PrimalForms takes out all of the manual grunt-work while giving you plenty of bells and whistles.

I was able to see a sneak preview of the 2011 version back in September when the CEO of Sapien, Dr. Ferdinand Rios, stopped by the NYC PowerShell User Group meeting to demo some of the new features. Recently, I was even more fortunate to get my hands on an actual copy of the pre-release binaries. With the blessing of Sapien, I have been given permission to give you my first impressions of this not-yet-ready-for-production product.

With the release of PrimalForms 2011 Sapien has taken a leap; PrimalForms 2011 is more full-fledged scripting environment than the niche utility product the 2009 version was. In addition, it adds some really nice features that will make the form generators really happy.

So, what’s new?

Templates for simple forms

When you click the new button there are a series of template winforms you may choose from. I like this feature. I’m not sure if it will be customizable or not, but it can definitely cut down on time for simple tasks – and let’s face it: when you are creating a GUI for a script it should always be for a simple task – otherwise you should be developing in C#, in my opinion.

Add Events

This is my absolute favorite feature! – It is the reason to upgrade. In 2009 you could double click on an item in your form and you would go to the default event for that item. In 2011 you can right click on any object in your form and choose add Events. This brings up a selector that lets you pick and choose from all of the available events for that object.

Goto Event

Oh man! So cool! Not only can you create events in the GUI, but you can right click on an object and click goto event to see what events you already have created. You can then click on one of those events to go right to the script section that handles the event.

Insert Recent Control

This is a nice little utility feature. It allows you to quickly add form items that you have recently added without having to go back and find them in the toolbox. This is sure to cut down on time when developing a form that creates 20 textboxes for input along with 20 labels to describe them.

WMI Browser

This is another nice one. The WMI browser is very clean. It can even generate a quick GUI query form for a single WMI query via right click -> Generate Query Form. This makes a simple winform that has some buttons and a datagridView. When the ‘Generate’ button is clicked it populates the datagrid with the WMI results.

Snippets

PrimalForms has a snippet library that you can browse. You can drag snippets from the browser directly into your scripts. You can also create your own snippits and organize them however you desire. Looking at the precanned snippits shows some usual suspects. However, there is one section that caught my eye called vbscript to PowerShell. While I cannot see myself ever using this section of the snippits (I’m sure others will), I did have a lot of fun dragging the various commands to my script to see the methods they employed.

Copy HTML

This is nice for the bloggers.  You can copy/paste an html version of the formatted and colored text within your script.  It looks so nice, I may start using it here.  Here’s an example of how it looks:

if ($true) { $hello="Hello World"$hello|Out-File hello.txt }

Projects

Just like in Visual Studio you can create a set of scripts bound together as a project.

PowerShell Console

They finally added a console panel – you can now interact with a shell in PowerShell without having to leave Primal Forms. The only problem with their implementation in the early preview is that I cannot run commands in my editor and have them exist in the shell session. In other words, if I set a variable in my script I cannot inspect that variable in the shell. When mentioning this point to Sapien I was told that there is new functionality in PrimalScript 2011 that will also be in PrimalForms. Specifically,

“…the ability to run the script that you are working on in a console of your choice with the push of a button. The console will perpetuate variable values etc, even if you switch to a different console. So you could run in 64bit PS console, switch to 32 bit PS console then switch back and variable state will be what it was. It acts just like you expect the console to act. You can also run the script from PrimalForms and That will be almost like a single instance console which gets reset every time.”

Controlling the Type of Session you are in

Sapien has added some really easy-to-use buttons that can control whether you are running within a 32-bit or 64-bit session. You can also quickly turn STA on and off on the main menu.

The Debugger

Full debugging appears to be in store for us. Unfortunately, this feature does not appear to be complete in my preview copy, but I imagine that it will be similar to the debugging we get in powershell_ise.exe. I assume that they will be using their own debugging engine rather than the built-in PowerShell debugging. It’s understandable why they would do this, but I really like the PowerShell debugger. Regardless of the engine, it will be very nice to be able to troubleshoot winform code directly in PrimalForms.

Data Source Browser

You can now connect to and create data sources via PrimalForms the way you would in Visual Studio. I didn’t get to play with this feature much yet, but it’s on my list of things to do. This may very well be the feature that turns PowerShell users into application developers. I expect to see some blog posts or tutorials dedicated to showing you how to bind winform objects to these data sources in the future.

Source Control

This is a big one!  My copy does not have the providers listed that are available.  Apparently you will only see source control providers that you have installed on your computer.  Unfortunately, I’m running this in a lab that is isolated from source control so I cannot test this out just yet.  If you use source control this is probably the most desirable feature to you in the new product.

Old Feature Revisited

I don’t want to go too crazy talking about things that most people already know about, but since I have been playing with the 2011 version of the product I have found an amazing way of using a feature that is also available in the 2009 product: the help browser. As you type in the script editor there is a help window that will show you the Get-Help for the cmdlet you are working with. A technique I have been playing with on the 2011 version is to undock the help window and put it on another monitor. This is such a cool way to develop that I had to point it out. There are even little clickable sections so that you can quickly go to any section in the help. I have already clicked the parameter section a few times in the two days I have had with the product. I highly suggest playing with this in the 2009 or 2011 version of the product.

Summary

This may or may not be an exhaustive list of the new features. These are the new ones that I noticed while playing with the product. Add them to the rich feature set that exists in the 2009 version and I think you can see why everyone is waiting with bated breath for this product to get released.

The new features definitely make PrimalForms more of a scripting environment, but I’m a bit of a snob when it comes to scripting environments. I exclusively use powershell_ise.exe that comes with PowerShell 2.0. There is an argument to be made that it is not really a scripting environment, but maybe that’s what I like about it. I want the quickest and fastest editor I can have when I script. Add debugging support, and I have everything I need – well, missing source control, but almost everything I need. I am inclined to give PrimalForms a shot as the “one ring to rule them all” when it is officially released. Whether that experiment is fruitful for me doesn’t really matter much because the new features will make the generation of winform GUIs a delight to create – That’s reason enough for me to upgrade.

Advertisements

10 responses to “PrimalForms 2011 – Sneak Peek

  1. denniver January 14, 2011 at 7:11 pm

    Looks interesting. Does it support WPF?

    • Tome January 18, 2011 at 4:38 pm

      It does not, but it does beg the question: what feature in WPF are you looking to take advantage of? I’m fairly certain I have not played with WPF enough to understand the benefits, but every time I ask the question I don’t really get an answer. The only valid reason I can think of may be that you could more easily pass your form off to be developed outside of PowerShell via Xaml, but that’s not a huge sell for me.

      • denniver January 20, 2011 at 3:03 pm

        Oh well, first of all, with WPF you got much more freedom of design when you creating a GUI . You may have noticed, during the last few years, increasingly more windows applications shifted from the classic styled GUI (like notepad) to more visually appealing and in the best case easier to use and more intuitive GUIs ( http://www.google.de/images?q=WPF GUI examples ). Also, think of things like floating menus, themes (like in Firefox), any kind of WYSIWYG editing (like in MS Project) or simply advanced data visualization (like http://tinyurl.com/6ktb8uo ), all these things you either cant do with Windows.Forms or its very difficult and not satisfying.
        And while one may think GUI design is not that important, especially for the kind of GUI based tools you may usually create with powershell, i disagree. A good GUI design is the key to usability. Just think about why Apple has this huge success with iOS (iPhone, iPad) although they provided less functionality than previous devices. Its all about the GUI.

      • Tome January 20, 2011 at 3:47 pm

        Without having a good tool to create the GUI, you really don’t get freedom of design. I have yet to see a PowerShell WPF GUI tool that works as simply as PrimalForms does with .Net winforms. If one exists please let me know. Even with using a tool to generate the xaml it seems overly complicated to get it to work – well, just as complicated as getting a winform to work, but at least PrimalForms is a nice tool to handle the hard work for you.

        I have no doubt that we will eventually see better tools to work with WPF in PowerShell than we have now. Whether that’s a future version of PrimalForms or some other tool I cannot say. From a GUI perspective I will wind up using whatever is fastest for me to create in.

        From the fun/hacking perspective – I definitely need to give the hardcore xaml/wpf stuff more of a go to really understand it. I have not played with it in C# at all. What I’ve touched in PowerShell is from the PowerShellPack only. Ugh…. the last thing I need is another side project…. thanks a lot denniver! 🙂

      • Denniver January 20, 2011 at 5:11 pm

        the last thing I need is another side project…. thanks a lot denniver!

        You’re welcome Tome! 😉 Seriously, i know exactly how you feel.

        Without having a good tool to create the GUI, you really don’t get freedom of design. I have yet to see a PowerShell WPF GUI tool that works as simply as PrimalForms does with .Net winforms

        You’re absolutely right, thats why i asked the WPF in PF question in the first place. I havent done as nearly as much WPF with posh as i would like to, because of exactly this.
        As for complexity, remember when you used windows.forms for the first time? I do and i clearly remember calling my computer names i won’t repeat here. 😉 I haven’t got to this point yet, but everybody’s telling me WPF is easier than Forms when you managed to get used to it. We’ll see…

  2. Pingback: Episode 136 – Jim Christopher on StudioShell and a Goodbye to Andy « PowerScripting Podcast

  3. Claus January 17, 2011 at 9:04 am

    Great post Tome… I can’t wait to get my hands on the new Primal Forms…

    I have putting off a rewrite of a PowerShell/Primal Forms helpdesk application I have written for our helpdesk staff, until the new version is released..

    –Claus T Nielsen
    PowerShell MVP

  4. David January 19, 2011 at 4:28 pm

    Any idea when it will be released?

  5. Boracay July 30, 2011 at 2:09 am

    Exactly what a good one you have in here. I hope I will be able to see even more writers just like you whoaddresses this subject. Thanks to you.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: