Posts Tagged ‘gui’


 

Write a Multi-Form PowerShell GUI App

Tuesday, July 26th, 2016 by June Blender
Tested on: PowerShell 2.0+, PowerShell Studio 2016 This step-by-step example shows you how to create a very simple multi-form PowerShell GUI app. The app consists of a parent form that gets data from a child form and displays it. When you finish, you'll know how to use the basic multi-form features of PowerShell Studio. For details about how these features work under the covers, see How Do Multi-Form Projects Work? For this task, we assume that you know how to create a single-form PowerShell GUI app or that you've participated in a Thinking in Events hands-on lab. Otherwise, start with…   More »

PowerShell GUI Apps: Why think in events?

Monday, January 4th, 2016 by June Blender
Always committed to starting the New Year right, I’m heading to Scottsdale, Arizona on Tuesday, January 5 at 5:30 PM to meet with the newly revived Arizona PowerShell User Group. We’ll meet at the Microsoft Store in Scottsdale Fashion Square. (I will not be distracted by the Surface Pro 4 on display. I will not…)   I’ll be there to lead an interactive hands-on lab in which participants build a basic PowerShell GUI application – essentially, a graphic user interface for a PowerShell script. When you press a button, it runs part of the script. When you type text in…   More »

How I learned to love DialogResult

Wednesday, December 23rd, 2015 by June Blender
This post discusses the DialogResult property of buttons, which often confuses beginning PowerShell GUI app designers. When I first started learning how to write PowerShell GUI applications, I thought of the DialogResult property of buttons as the "evil property." What else would I think? If the DialogResult property of a button is set to any value other than None, when you click the button, the GUI app closes immediately after running the commands in my event handler. In this little app, when you click OK, it pipes a Get-Service command to Out-GridView -- um, very briefly. [video width="1280" height="670" mp4="https://www.sapien.com/blog/wp-content/uploads/2015/12/DialogResult.mp4"][/video]…   More »

Spotlight on the Label Control

Wednesday, December 16th, 2015 by June Blender
The Spotlight on Controls series describes the controls, that is, the objects in the System.Windows.Forms namespace, so you can use them effectively when building GUI apps in PowerShell Studio and PrimalScript. Each post focuses on one control and lists its most important properties, methods, and events, including the default event that PowerShell Studio adds to your script when you double-click the control. The posts include many examples written in Windows PowerShell, so you can use them right away. Read more: Spotlight on Controls: Common properties and methods This post describes the Label control. Label Control [System.Windows.Forms.Label] Creates a clickable text…   More »

PowerShellGet-GUI Part 2

Thursday, November 12th, 2015 by Ferdinand Rios
Continuing on from where we left off in our last blog post entitled "PowerShellGet-GUI part 1", let us examine some of the other features of the PowerShell Get GUI application. With our list successfully loaded with PowerShell Gallery modules, the user can take several actions: Select a module to inspect it's properties Select a non-installed module to install it Select an installed module to uninstall it Case 1 [caption id="attachment_10223" align="aligncenter" width="1273"] Figure 1[/caption] When the user clicks on an item in the list, the listview_ItemSelectionChanged event fires and is handled by our $lvModules_ItemSelectionChanged event handler seen in Figure 1…   More »

PowerShellGet-GUI Part 1

Tuesday, November 10th, 2015 by Ferdinand Rios
Back in mid-September, I presented a talk on "Building PowerShell GUI Tool Solutions" at the PowerShell Conference Asia in Singapore. The talk centered around GUI application design and development using PowerShell as the core language. During that talk , I developed an application that used PowerShell's PSGet module to communicate with the PowerShell Gallery. Finishing work was done by Devin Leaman of SAPIEN Technologies. The recorded talk should be available at some point on the PowerShell Conference Asia Website. The application creates an interface that displays gallery module information and allows the user to easily add and remove modules from their…   More »

PowerShell Studio 2015 – New FolderBrowserModernDialog Control

Friday, May 1st, 2015 by David Corrales
With release of the v4.2.83 build of PowerShell Studio 2015, we introduced new features that we are covering in detail over a series of articles. This next new feature was also added in response to user feedback. This particular user wanted to use the modern version of the folder browser dialog that is available in the later versions of Windows. Unfortunately, the user had to manually add code to the form to accomplish this. Therefore we added a new control to our toolbox: FolderBrowserModernDialog This control will display the modern version of the FolderBrowserDialog on Windows 7 or greater: If…   More »

PowerShell Studio: Knowing when to use STA mode

Monday, March 9th, 2015 by David Corrales
Follow @SAPIENDavid Recently, on our forums, a user asked why certain controls didn’t function correctly or threw an error when he unchecked the STA option in PowerShell Studio. STA (Single Threaded Apartment) and MTA (Multi-Threaded Apartment) determine how a process manages legacy COM objects and their communication with multiple threads. I will not go into the detail, but you need not concern yourself with the inner workings of COM objects, other than to remember that STA is required for some of the GUI controls to function correctly. If you're interested in the details, see Processes, Threads, and Apartments in the…   More »

PowerShell Studio: Form and Script Recovery

Monday, October 20th, 2014 by David Corrales
Once in a while our support team gets a request to recover a script from a packaged executable because the original was lost. In fact this just happened recently when a user contacted us to recover his lost form project from his packaged script. We were able to recover the script, but unfortunately the user still had to rebuild all his GUI forms from scratch. He was at least fortunate enough to be able to copy and paste the script portions of his project without having to completely rewrite it all. Please don’t find yourself in the same situation. For…   More »

Customizing the Console

Tuesday, October 7th, 2014 by June Blender
Even though I’ve been writing scripts for years, I find that I work in the Console Pane in PowerShell Studio 2014 almost as much as I work in the Editor Pane. I use the Console Pane to look up commands and syntax (Get-Command), test a parameter value, or work through the details of a pipeline or a formatting technique before I add it to a script. And, there are many things I do interactively. So, I’m pretty picky about the way my console looks and operates. When I set up PowerShell Studio 2014 on a new machine, one of the…   More »