Change the Day–YOU can make the difference #TECHDAYS-CA at Halifax

At the Techdays-ca in Halifax, Nova Scotia YOU can make a difference.

Donations for Feed Nova Scotia are being taken at the conference.   You can make a difference in some small way in a great way.

Why bother?

Why not?

Because at one point in YOUR life you may be there.  Or a friend will be there.  Or a relative.

Someone will need.

The most basic need of all, a meal

A meal, food can change the difference from despair to belief.  A meal can change someone from faint to life.

… the power is in you.  You can change the day for somebody. 

I know what it’s like to have little to spend, and I also know we can all contribute.  Our time, a smile.

A meal.

The Power is in us all.

So you, when you’re at Techdays-ca in Halifax and have a dollar or ANYTHING.

Contribute to Feed Nova Scotia, with that change YOU will have seized the day and made a change

In doing so, you will have changed a person.

and probably made yourself feel a little better, is that so selfish?

Seize the day and make a change.

Give to Feed Nova Scotia, just because you might even be doing a little better than before, and somebody else isn’t.

…And because at one point, you might know what it feels to need.

Powershell–A form created for #techdays-ca with Primal Script

powershell

Guess what I did? I wrote CODE! An ITPro crossed into a new land.  Code.

Primal forms Community Edition (*FREE*) from Sapien creates a Powershell Script that creates the Code to produce a form on the screen.

Once you play with the forms and read the basic document on Primal Forms?  You can create a GUI Form launched from Powershell.

So I played with my little script to countdown Techdays.   Once I learned the basics, it wasn’t actually THAT HARD to put that script code INTO the form.

So I present to you humbly my little Script called TechdaysForm.PS1

To get the cool graphic, save the “TechdaysLittleMan” graphic at the bottom of the screen into a folder called C:Techdays calling it Techdays.Jpg

The Form relies on this.  It’s my first attempt into code, and something to learn from.

Yes you too, the ITPro can safely play with code and make YOUR scripts user friendly, or at the very least “CoOp student Friendly” Open-mouthed smile

The Power of Shell is in YOU!

Sean – The Energized Tech

————–techdaysform.ps1————————

#Generated Form Function
function GenerateForm {

$Locations=@()

$Locations+=("Edmonton","10/6/2010"),("Toronto","10/27/2010"),("Halifax","11/02/2010"), ("Ottawa","11/09/2010"),("Montreal","11/23/2010"),("Winnipeg","12/07/2010"), ("Calgary","12/14/2010")

########################################################################
# Code Generated By: SAPIEN Technologies PrimalForms (Community Edition) v1.0.8.0
# Generated On: 10/26/2010 11:37 PM
# Generated By: sean.kearney
########################################################################

#region Import the Assemblies
[reflection.assembly]::loadwithpartialname("System.Windows.Forms") | Out-Null
[reflection.assembly]::loadwithpartialname("System.Drawing") | Out-Null
#endregion

#region Generated Form Objects
$Techdays = New-Object System.Windows.Forms.Form
$richTextBox1 = New-Object System.Windows.Forms.RichTextBox
$ComboBoxTitle = New-Object System.Windows.Forms.Label
$pictureBox1 = New-Object System.Windows.Forms.PictureBox
$comboBox1 = New-Object System.Windows.Forms.ComboBox
$saveFileDialog1 = New-Object System.Windows.Forms.SaveFileDialog
$InitialFormWindowState = New-Object System.Windows.Forms.FormWindowState
#endregion Generated Form Objects

#———————————————-
#Generated Event Script Blocks
#———————————————-
#Provide Custom Code for events specified in PrimalForms.
$handler-comboBox1-SelectedValueChanged=
{
#TODO: Place custom script here
if ($combobox1.SelectedItem) {

$CountdownDate=$Locations | where { $- -like $ComboBox1.SelectedItem }
$City=$Combobox1.SelectedItem
$RemainingDays=([datetime]$CountdownDate[1]-(GET-DATE)).Days
$CityName=$CountdownDate[0]

$RichTextBox1.Text="It is $RemainingDays Days until Techdays at $City"
$RichTextBox1.Visible=$TRUE

}

}

$handler-label2-Click=
{
#TODO: Place custom script here

}

$handler-pictureBox1-Click=
{
#TODO: Place custom script here

}

$OnLoadForm-StateCorrection=
{#Correct the initial state of the form to prevent the .Net maximized form issue
    $Techdays.WindowState = $InitialFormWindowState
}

#———————————————-
#region Generated Form Code
$Techdays.BackColor = [System.Drawing.Color]::FromArgb(255,215,228,242)
$Techdays.Text = "Techdays Countdown"
$Techdays.AccessibleDescription = "Techdays Countdown"
$Techdays.Name = "Techdays"
$Techdays.AccessibleName = "Techdays Countdown"
$Techdays.DataBindings.DefaultDataSourceUpdateMode = 0
$System-Drawing-Size = New-Object System.Drawing.Size
$System-Drawing-Size.Width = 416
$System-Drawing-Size.Height = 175
$Techdays.ClientSize = $System-Drawing-Size

$richTextBox1.Name = "richTextBox1"
$richTextBox1.Text = ""
$richTextBox1.DataBindings.DefaultDataSourceUpdateMode = 0
$System-Drawing-Point = New-Object System.Drawing.Point
$System-Drawing-Point.X = 159
$System-Drawing-Point.Y = 66
$richTextBox1.Location = $System-Drawing-Point
$System-Drawing-Size = New-Object System.Drawing.Size
$System-Drawing-Size.Width = 243
$System-Drawing-Size.Height = 96
$richTextBox1.Size = $System-Drawing-Size
$richTextBox1.TabIndex = 4
$richTextBox1.Font= New-Object System.Drawing.Font("Arial",16,2,3,1)

$Techdays.Controls.Add($richTextBox1)

$ComboBoxTitle.TabIndex = 3
$ComboBoxTitle.TextAlign = 32
$System-Drawing-Size = New-Object System.Drawing.Size
$System-Drawing-Size.Width = 390
$System-Drawing-Size.Height = 23
$ComboBoxTitle.Size = $System-Drawing-Size
$ComboBoxTitle.Text = "How Many Days until Techdays? Select YOUR City from the Pulldown box"
$ComboBoxTitle.Font = New-Object System.Drawing.Font("Arial",8,2,3,1)

$System-Drawing-Point = New-Object System.Drawing.Point
$System-Drawing-Point.X = 12
$System-Drawing-Point.Y = 9
$ComboBoxTitle.Location = $System-Drawing-Point
$ComboBoxTitle.DataBindings.DefaultDataSourceUpdateMode = 0
$ComboBoxTitle.Name = "ComboBoxTitle"
$ComboBoxTitle.add-Click($handler-label2-Click)

$Techdays.Controls.Add($ComboBoxTitle)

$pictureBox1.TabIndex = 1
$pictureBox1.SizeMode = 4
$System-Drawing-Size = New-Object System.Drawing.Size
$System-Drawing-Size.Width = 140
$System-Drawing-Size.Height = 125
$pictureBox1.Size = $System-Drawing-Size
$pictureBox1.ImageLocation = "C:TechdaysTechdays.jpg"

$System-Drawing-Point = New-Object System.Drawing.Point
$System-Drawing-Point.X = 12
$System-Drawing-Point.Y = 38
$pictureBox1.Location = $System-Drawing-Point

$pictureBox1.TabStop = $False
$pictureBox1.Name = "pictureBox1"
$pictureBox1.DataBindings.DefaultDataSourceUpdateMode = 0
$pictureBox1.add-Click($handler-pictureBox1-Click)

$Techdays.Controls.Add($pictureBox1)

$comboBox1.FormattingEnabled = $True
$System-Drawing-Size = New-Object System.Drawing.Size
$System-D
rawing-Size.Width = 244

$System-Drawing-Size.Height = 21
$comboBox1.Size = $System-Drawing-Size
$comboBox1.DataBindings.DefaultDataSourceUpdateMode = 0
$comboBox1.Name = "comboBox1"
$comboBox1.Items.Add("Calgary")|Out-Null
$comboBox1.Items.Add("Edmonton")|Out-Null
$comboBox1.Items.Add("Halifax")|Out-Null
$comboBox1.Items.Add("Montreal")|Out-Null
$comboBox1.Items.Add("Ottawa")|Out-Null
$comboBox1.Items.Add("Toronto")|Out-Null
$comboBox1.Items.Add("Vancouver")|Out-Null
$comboBox1.Items.Add("Winnipeg")|Out-Null
$System-Drawing-Point = New-Object System.Drawing.Point
$System-Drawing-Point.X = 158
$System-Drawing-Point.Y = 38
$comboBox1.Location = $System-Drawing-Point
$comboBox1.Sorted = $True
$comboBox1.TabIndex = 0
$comboBox1.add-SelectedValueChanged($handler-comboBox1-SelectedValueChanged)

$Techdays.Controls.Add($comboBox1)

$saveFileDialog1.ShowHelp = $True
$saveFileDialog1.CreatePrompt = $True

#endregion Generated Form Code

#Save the initial state of the form
$InitialFormWindowState = $Techdays.WindowState
#Init the OnLoad event to correct the initial state of the form
$Techdays.add-Load($OnLoadForm-StateCorrection)
#Show the Form
$Techdays.ShowDialog()| Out-Null

} #End Function

#Call the Function
GenerateForm

————–techdaysform.ps1————————

Powershell – the Secret behind “Primal Forms”

powershell

I played today.  I had 3 minutes to play.  So I played with Primal forms.  Because it is FUN to play in Powershell…

I never knew just Why people went “GAGA” for Primal Forms and I now Understand the “WHY”

Primal Forms is big funky lookin’ GUI monster to draw “Forms” (something Developers and Microsoft Access users are familiar with)

Think of a form in it’s most simplistic sense as a sheet of paper full of programs.   You click on button, a program launches, the mouse moves; a program launches; You look at Aunt Mildred a program launches.  

Those are capabilities of a form.

In it’s MOST MOST MOST MOST basic sense, A form can gather information.  So you LITERALLY draw up a form.  drop things on it.  Edit pieces.

La la la la …… Done!

So it looks cool and just … well… to the ITPro at least … just what do I DO with this?

In Primal Forms Community Edition (Free to download and use) there is an “Export to Powershell” option.

This generates PURE Powershell code requiring absolutely no Add-ins. 

All Primal Forms does is take features that are NATIVE to Windows and builds a Powershell script that launches it.

Cool.  Pretty Picture on the screen. 

Why do I care?

Because like Everything in Powershell.  You can run a “GET-MEMBER” against the forms for Methods and Properties.   Jeffrey Hicks wrote some beautiful samples for Primal Forms. 

Do you know how I figured out Primal Forms?  I loaded a “Sample PS1” from the Samples folder and loaded the Sample Primal Script Format File and RE-Exported it to Powershell.

Then using Powershell ISE (and CTRL-TAB) I flipped back and forth to see the DARN DIFFERENCE!

Son of gun! It’s easy!

Son of gun! It’s Free!

Son of gun, Like Powershell, Download it now it’ll take no time!

Primal Forms is cool because as an Administrator you can build a script to do something simple (like RESET a password for a domain) and then merge it into Primal Forms to allow others to use it EASILY.

No matter, I’d like to personally tip my hat to Sapien Technologies, Jeffrey Hicks and all those that came before me.

You made Powershell and Forms EASY for the rest of us.

If you’re curious?  Check out www.primaltools.com for MORE Power from Sapien !  Unleash the Power from within YOU, whether it’s Powershell, vbScript or just your imagination!

Sean
the Energized Tech