Primalforms Community Edition Tutorial For Excel

Posted on

Code Generated By: SAPIEN Technologies PrimalForms (Community Edition) v1.0.7.0. Initial post had that functionality but I could not double click the files to open the files in the appropriate application (i.e.doc with word, xls with excel, etc) Can you assist? We just can't give you an interactive tutorial. In this example, we will import data from Excel to QlikView so, we are clicking the Table Files. Once you select this option, it will open the list of files available in your file system. Please navigate to the folder where your excel file resides, and then select the excel file as we shown below. The Community Dashboard Editor(CDE) is community edition and comes under ctools plugin.The CDE has come to Pentaho after its acquisition of Webdetails. The CDE can be integrated with Pentaho BA server(CE/EE) from the market place. This is based on common framework CDF and it simplifies creation, edition and rendering of CTools dashboards.

  1. Primalforms Community Edition Tutorial For Excellence

Hey, Scripting Guy! I have really been enjoying reading your Weekend Scripter series. It seems like you guys really love scripting. I especially enjoyed the graphical trip cost calculator Ed wrote for the Scripting Wife.

My only problem with the article is that it was a bit quick, and I have never used Visual Studio or a Windows Form before. I am a complete beginner, and if it is not too much trouble, I could use a very basic example.

— JB

Hello JB,

Microsoft Scripting Guy Ed Wilson here. I am listening to Vanessa-Mae, sipping a nice gunpowder green tea, and looking through pictures I took while scuba diving in Cozumel, Mexico. I have an old high school friend who is going down there, and I wanted to put a few pictures on Facebook for her to see. Here is one of my favorite photographs from Cozumel.

JB, the first thing you need to do after downloading the free PrimalForms Community Edition is open a new project. After the project appears, you need to modify the title of the Windows Form. To do this, change the Text property on the right side of the Primal Forms utility, as shown in the following image.

After you have modified the Text property of the new Windows Form, resize it. To do this, grab one of the three handles, to resize the width, the height, or both, as shown in the following image.

Using your left mouse button, drag a label control from the left palette to the Scripting Guys Clock form. When you move the mouse around inside the form, as you approach one of the four sides, little blue alignment lines will appear. Place the control somewhere in the middle of the form. Set the default text value for the label to Time, and rename the label from label1 to lbl_DisplayTime. The label name is in the Design section. This is shown in the following image.

Now we need to modify the size of the font. To do this, click the three dots next to the font property under appearance, and the Font tool shown in the following image appears. You can then choose the font, style, and size.

Drag a Button control to the Scripting Guys Clock form, and place it on the lower left side. Use the guidelines that appear to aid you in placement. After you have placed the button control, change the text of the button to Get Time as shown in the following image.

In the Design section, change the name of the button from button1 to btn_GetTime, as shown in the following image.

Now it is time to click Export PowerShell to save the Windows PowerShell code that will be used to create the Scripting Guys Clock form. This is shown in the following image. You may also wish to save the PrimalForms project, in case you ever want to modify the project in the future.

Open the clock project Windows PowerShell code in the Windows PowerShell ISE, and modify the code for the OnClick event. There are two comments in the code that will help you find this section. After you have located the code for the OnClick event, add code that will retrieve the current time, turn it into a string, and assign it to the Text property of the $lbl_DisplayTime object. This is seen here:

#Provide Custom Code for events specified in PrimalForms.

$btn_GetTime_OnClick=

{

#TODO: Place custom script here

$lbl_DisplayTime.Text = (get-date).tostring()

}

When the Scripting Guys Clock runs, the form will appear. Click Get Time, and the value of the label changes from Time to the current date and time. Anytime you click Get Time, the time will be refreshed. This is shown in the following image.

JB, that is a more in-depth discussion of creating Windows Forms using Windows PowerShell and PrimalForms. The complete code for the Scripting Guys Clock is on the Script Center Script Repository. Graphical Windows PowerShell Week will continue tomorrow when we will talk about…wait a minute.

If you want to know exactly what we will be looking at tomorrow, follow us on Twitter or Facebook. If you have any questions, send e-mail to us at scripter@microsoft.com or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then, peace.

Ed Wilson and Craig Liebendorfer, Scripting Guys

HTML Applications (HTA) are very useful to provide a Graphical User Interface (GUI) to your VBscript, to ease its use, avoid typing mistakes and provide better output.
Would it be possible to do similar thing in PowerShell?
Unfortunately, Powershell does not allow you to use HTA as you can do to provide a GUI for your VBscripts.
However, Powershell gives you access to .Net libraries which means that you can create a GUI using Windows Forms. Here is a example of what it looks like:
[void] [System.Reflection.Assembly]::LoadWithPartialName('System.Drawing')
[void] [System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms')

$objForm = New-Object System.Windows.Forms.Form
For$objForm.Text = 'My PowerShell Form'

$objLabel = New-Object System.Windows.Forms.Label
$objLabel.Location = New-Object System.Drawing.Size(20,20)Primalforms
$objLabel.Text = 'Hello World!'
$objForm.Controls.Add($objLabel)

$ExitButton = New-Object System.Windows.Forms.Button
$ExitButton.Location = New-Object System.Drawing.Size(80,80)
$ExitButton.Text = 'Exit'Edition

Primalforms Community Edition Tutorial For Excellence


$ExitButton.Add_Click({$objForm.Close()})
$objForm.Controls.Add($ExitButton)

$objForm.ShowDialog()
You can copy the code in file, save it as test.ps1 and execute the script with PowerShell; you'll see a GUI like this:
This is not an easy task as Windows Forms will require a lot more coding than HTA, but you can design really nice interfaces for your scripts.
In order to ease the delivery of forms, without having to type hundreds of lines of code, you can use a free tool from Sapien to create the code behind the GUI called PrimalForms. You'll be able to design the GUI and it will generate the code for you. Then, all you have to do is to merge the 'GUI code' into your script and link the events.
To find PrimalForms Community Edition, you'll have to access the download section on Sapien website and create an account. I'm telling you: it's worth doing it, and it's free.
References:
System.Windows.Forms Namespace
Sapien - PrimalForms Community Edition