Feature Peek 2011: PrimalForms 2011 – Creating multiple event handlers at once

This month, we are looking at PrimalForms 2011 and how to add event handlers to form controls. After evaluating PrimalForms 2009 and user feedback, we decided to improve the process of adding event handlers in PrimalForms 2011. In PrimalForms 2009, you can create the default event by double clicking on the control or by using the […]

Read More

Get-GuiDate: A PowerShell Calendar Tool

Forms and dialogs can augment PowerShell scripts or even resurface them completely to make them more friendly for people who aren’t familiar with the command line. In some cases, a form can even function as a complete script in and of itself. The Get-GuiDate script, developed from a prototype written with PrimalForms, is an example of a script that is completely centered around a control (the Windows.Forms.MonthCalendar control) embedded in a Windows Form.

Read More

Updated PowerShell TreeForm

Not too long ago I wrote a blog post about a Windows Form PowerShell script to display a folder tree. I got some feedback about an error when running the script. The problem was that I was casting a variable in one of the functions to a specific type. Normally this is considered a best practice. But in this situation the [System.Windows.Forms.TreeNode] class depends on the parent class being loaded in your PowerShell session. Even though I thought I had tested thoroughly on PowerShell v1 and v2 I must have missed something and the [System.WIndows.Forms] class was getting loaded into my shell prior to running the script, which is why I never saw the error. Anyway, I’ve since modified the problematic function to remove the type casting.

Read More

Cool Config Creation

In my recent Special Forces PowerShell class, one of the students brought up a challenge he was facing when we were talking about the -f replacement operator. This is a handy way to build strings.

PS C:\> “Hello, {0}. It is now {1} and you have {2} processes running.” -f $env:username,(get-date).ToShortDateString(),
(get-process | measure-object).count
Hello, Jeff. It is now 5/5/2009 and you have 82 processes running.

Paul needed to build configuration files and was looking for an easy way, perhaps using a here string as a template. We tossed around a few ideas. When I got home I decided to see what I could come up with. What I have is a proof of concept really, but it might get you started.

Read More

Up another PowerShell Tree

A few weeks ago I posted a PowerShell script that created a directory tree, like the TREE command from the CMD shell. Then while testing something new in PrimalForms, I realized I had a literal form object, a tree view, that I could use. So I put together a short script that creates a graphical tree for a given directory, along with the file counts and sizes from my original scripts. As a bonus, because I now had a graphical interface I could do things such as display empty folders in a different color. The script not only gives you a handy tool but also serves as a demonstration on how to use a TreeView control.

Read More

Winforms and Timers

There’s been some discussion lately in the SAPIEN product forums about PrimalForms and timers. As you know, PowerShell v1.0 is essentially single-threaded. This generally means that timers and asynchronous code won’t work. But you can use a simple timer in a Windows form. Here’s an example of how you might use such a timer.

Read More

Getting Started with PrimalForms

I hope you are as excited about the release of PrimalForms as I am. In the past creating a Windows form in PowerShell was a very tedious task and one I rarely used except for the most simplest of forms. No more. The free PrimalForms tool lets me create a very rich Windows form using a WYSIWYG editor. I can export the form to a file, add my PowerShell code and call it a day.

Read More

Search

Enter any query and press enter
Advanced search operators:
+ ⟶ Term must appear
- ⟶ Term must not appear
"" ⟶ Exact string must appear
How do I use these?

Join our mailing list

Enter your email address to subscribe to our mailing lists for Monthly Blog Digests, Product Announcements and more (you can choose which you receive once you sign-up!)

Tags

Categories

Archives

Dashboard