Free PrimalForms tool for PowerShell released
We are pleased to announce that the free GUI builder tool for PowerShell is now available for download.
Head on over to http://www.primaltools.com/freetools to get it.
(Registrations with a valid email address is required)
The tool works with PowerShell V1 and the current V2 CTP. Our very own Jeffery Hicks created some samples that are included with the installer.
If you have questions, comments or suggestions, please head over to the free tools section in our support forum.
Tags: forms, gui, powershell, PrimalForms, SAPIEN, Windows, Winforms

November 3rd, 2008 at 1:01 pm
You guy makes me so happy
Thanks.
November 4th, 2008 at 7:25 am
Eagerly awaited – this’ll be a big hit. I’ll let everyone know about it at the upcoming Windows Connections workshops.
November 4th, 2008 at 8:06 am
[...] Bron: http://blog.sapien.com/index.php/2008/11/03/free-primalforms-tool-for-powershell-released/ [...]
November 4th, 2008 at 8:19 am
Great tool, but we could use some tutorials. I probably just haven’t figured out how to do it yet, but I can’t seem to be able to add a control, put code in for it, then add additional controls. There seems to be a strict difference between this tool outputting .ps1 files and .pff. The .pff files are great for re-opening and adding new controls or changing the layout of the form, but once you export it to a .ps1 and start adding code, there doesn’t seem to be a way to edit that .ps1 and add more controls (buttons, textboxes, etc). I’m sure I’m missing something simple, I can’t imagine you guys would make it so someone had to completly design the form first, then add the code without the ability to change the form layout and add additional controls.
November 4th, 2008 at 8:23 am
There is a Getting Started Guide which walks you through most of the tool, plus some sample forms and scripts so you can see how things go together.
The form generator is only responsible for generating code to create the form. What I did when I need to make changes was export the new form to the clipboard, paste into a new file, then copy and paste the new form code into my existing script, keeping all the the script blocks and functions.
November 20th, 2008 at 5:55 am
Wow, that’s pretty cool. Thanks for creating more free tools.
January 25th, 2009 at 7:11 am
This form designer is cool and very easy to use.
Here is my 1st attempt at creating a winform, which just does a get-content’s on a selected file:
#Generated Form Function
function GenerateForm {
########################################################################
# Code Generated By: SAPIEN Technologies PrimalForms v1.0.1.0
# Generated On: 25/01/2009 14:50
# Generated By: administrator
########################################################################
#region Import the Assembles
[reflection.assembly]::loadwithpartialname(“System.Windows.Forms”) | Out-Null
[reflection.assembly]::loadwithpartialname(“System.Drawing”) | Out-Null
#endregion
#region Generated Form Objects
$form1 = New-Object System.Windows.Forms.Form
$DisplayFile_Window = New-Object System.Windows.Forms.RichTextBox
$SelectFile_Window = New-Object System.Windows.Forms.RichTextBox
$SelectFile = New-Object System.Windows.Forms.Button
$groupBox1 = New-Object System.Windows.Forms.GroupBox
$Displayfile = New-Object System.Windows.Forms.Button
$openFileDialog1 = New-Object System.Windows.Forms.OpenFileDialog
#endregion Generated Form Objects
#———————————————-
#Generated Event Script Blocks
#———————————————-
#Provide Custom Code for events specified in PrimalForms.
$EnteredText=
{
$ifile = $SelectFile_Window.Text
}
$Displayfile_OnClick=
{
If(!$ifile -eq $False)
{
$iFileGC = Get-content $ifile
$iFileContents = [string]::join([environment]::NewLine,$iFileGC)
$DisplayFile_Window.Text = $iFileContents
}
Else {$DisplayFile_Window.Text = “No file selected”}
}
$SelectFile_OnClick=
{
$openFileDialog1.ShowDialog()
$ifile = $openFileDialog1.FileName
$SelectFile_Window.Text = $ifile
}
#———————————————-
#region Generated Form Code
$form1.Text = ‘My 1st Primal Form’
$form1.Name = ‘form1′
$form1.DataBindings.DefaultDataSourceUpdateMode = 0
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 299
$System_Drawing_Size.Width = 436
$form1.ClientSize = $System_Drawing_Size
$DisplayFile_Window.WordWrap = $False
$DisplayFile_Window.Name = ‘DisplayFile_Window’
$DisplayFile_Window.Text = ”
$DisplayFile_Window.DataBindings.DefaultDataSourceUpdateMode = 0
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 10
$System_Drawing_Point.Y = 64
$DisplayFile_Window.Location = $System_Drawing_Point
$DisplayFile_Window.ReadOnly = $True
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 223
$System_Drawing_Size.Width = 409
$DisplayFile_Window.Size = $System_Drawing_Size
$DisplayFile_Window.TabIndex = 3
$form1.Controls.Add($DisplayFile_Window)
$SelectFile_Window.Multiline = $False
$SelectFile_Window.WordWrap = $False
$SelectFile_Window.Name = ‘SelectFile_Window’
$SelectFile_Window.Text = ”
$SelectFile_Window.DataBindings.DefaultDataSourceUpdateMode = 0
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 12
$System_Drawing_Point.Y = 35
$SelectFile_Window.Location = $System_Drawing_Point
$SelectFile_Window.EnableAutoDragDrop = $True
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 23
$System_Drawing_Size.Width = 293
$SelectFile_Window.Size = $System_Drawing_Size
$SelectFile_Window.TabIndex = 1
$SelectFile_Window.add_TextChanged($EnteredText)
$form1.Controls.Add($SelectFile_Window)
$SelectFile.TabIndex = 0
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 23
$System_Drawing_Size.Width = 27
$SelectFile.Size = $System_Drawing_Size
$SelectFile.Name = ‘SelectFile’
$SelectFile.UseVisualStyleBackColor = $True
$SelectFile.Text = ‘…’
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 311
$System_Drawing_Point.Y = 34
$SelectFile.Location = $System_Drawing_Point
$SelectFile.DataBindings.DefaultDataSourceUpdateMode = 0
$SelectFile.add_Click($SelectFile_OnClick)
$form1.Controls.Add($SelectFile)
$groupBox1.Name = ‘groupBox1′
$groupBox1.Text = ‘Select file to view’
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 284
$System_Drawing_Size.Width = 426
$groupBox1.Size = $System_Drawing_Size
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 3
$System_Drawing_Point.Y = 12
$groupBox1.Location = $System_Drawing_Point
$groupBox1.TabStop = $False
$groupBox1.DataBindings.DefaultDataSourceUpdateMode = 0
$groupBox1.TabIndex = 5
$form1.Controls.Add($groupBox1)
$Displayfile.TabIndex = 0
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 23
$System_Drawing_Size.Width = 75
$Displayfile.Size = $System_Drawing_Size
$Displayfile.Name = ‘Displayfile’
$Displayfile.UseVisualStyleBackColor = $True
$Displayfile.Text = ‘Display file’
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 341
$System_Drawing_Point.Y = 22
$Displayfile.Location = $System_Drawing_Point
$Displayfile.DataBindings.DefaultDataSourceUpdateMode = 0
$Displayfile.add_Click($Displayfile_OnClick)
$groupBox1.Controls.Add($Displayfile)
$openFileDialog1.FileName = ‘openFileDialog1′
#endregion Generated Form Code
#Show the Form
$form1.ShowDialog()| Out-Null
} #End Function
#Call the Function
GenerateForm
Many thanks for the tool.
James
January 26th, 2009 at 6:11 am
What OS did you develop on? I’m having trouble on Vista x64 to get the dialog to open. But it could just be me. You can also simplify the content parsing. You are correct that it needs to be as a string but you can simply do this:
$DisplayFile_Window.Text = Get-Content $ifile | Out-String
February 1st, 2009 at 1:49 pm
Thanks Jeff
I ran into the same problem as you on vista 32bit, so did it on a windows 2003 sp2 server.
Cheers,
James
February 5th, 2009 at 4:55 pm
[...] what’s next, you ask? How about a fully PowerShell (primalforms driven) generated WinForm to wrap all this??? Maybe a little something [...]
June 4th, 2009 at 12:53 am
[...] http://blog.sapien.com/index.php/2008/11/03/free-primalforms-tool-for-powershell-released/ [...]
August 5th, 2009 at 9:15 am
[...] of creating a new script. There are also several sample forms and scripts. Read the release announcement and a followup. Technorati Tags: PrimalForms,PowerShell,WinForms,Scripting,SAPIEN Tags: [...]