Introduction to Automatic Grid with PowerShell:
I’ve worked on a couple of PowerShell automation frameworks, that are always-ON, which is basically a bunch of scripts continuously running on a machine to monitor, test, build or for any other possible use case. One can check the live status of these scripts by logging onto the box and resize-drag-arrange any spawned script or application properly on the screen so that they don’t overlap so that you can read them properly, which I personally found very irritating.
Similarly, when I was testing socket programmed python chat application I wrote, from multiple Telnet clients it was mess to arrange and resize, something like in the below screenshot
but recently, when I started working on one of my bot’s which spawns multiple PowerShell script jobs on my screen , I literally lost my patience while testing and started a parallel side project to set all PowerShell consoles (or any other application) automatically in a grid layout like in the below image.
Thanks to that NO MORE RESIZE-DRAG-ARRANGE! phew!
To make it available to the community I wrapped this side project script in a module and making it public with this blog post. The project is publically hosted on a Github repository where you can assist me to make it better.
Module Installation:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Installation on PowerShell v5 from Powershell Gallery | |
# [Recommended] Install to your personal PowerShell Modules folder | |
Install-Module Gridify -scope CurrentUser | |
# [Requires Elevation] Install for Everyone (computer PowerShell Modules folder) | |
Install-Module Gridify | |
# Installation PowerShell V4 and Earlier from Github repository | |
# To install to your personal modules folder run: | |
iex (new-object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/PrateekKumarSingh/Gridify/master/Install.ps1') | |
Features:
‘Gridify’ module provides a cmdlet ‘Set-GridLayout’ that can resize and arrange applications in an automatic grid layout with predefined formats using the ProcessID’s of the target applications passed as a parameter(-ProcessID) value.
Cmdlet can automatically calculate your screen resolution and set Applications in a neat grid layout in predefined/custom layout
Available predefined layout formats are –
-
Mosaic:
This is the default layout of the cmdlet, which sets all applications with the best fit possible in 2 rows.
-
Vertical:
Vertical Layout sets all applications vertically side by side in a single row to fit the screen resolution
-
Horizontal:
Horizontal Layout sets all applications horizontally one over another in a single column to fit the screen resolution
-
Custom:
A custom format can be used to set the applications in a grid-layout on the screen, by passing a custom string as a value to the parameter(-Custom).
To set applications is custom grid-layout utilize the ‘Custom’ parameter and pass the custom layout as comma-separated string of * (Asterisk)Where “*” represent an application and “,” separates a row in the grid-layout
So, with custom format like in the below example, the grid layout would be like
Row1 has 3 applications
Row2 has 2 applications
Row3 has 1 applications
Row4 has 4 applications
Known Issues and Limitations:
Please follow the below link to the Github repository of the module for known issues and some limitations, which would be fixed/enhanced soon.
Hope you’ll find the script useful and Thanks for reading.
Please do follow me on twitter for more Interesting PowerShell material and don’t forget to Showoff your Powershell Gridify module to your colleagues, Cheers! 😉
Prateek Singh
Related posts
3 Comments
Leave a ReplyCancel reply
Categories
Author of Books
Awards
Open Sourced Projects
Author at
Blog Roll
Mike F RobbinsDamien Van Robaeys
Stéphane van Gulick
Kevin Marquette
Adam Bertram
Stephanos Constantinou
Francois-Xavier Cat
Ravikanth Chaganti
Roman Levchenko
Blog Stats
- 1,132,428 People Reached
[…] my previous blog post, I Introduced Gridify Module and I would be covering in recent enhancements and updates made in this module […]
[…] my previous blog post, I Introduced Gridify Module and I would be covering in recent enhancements and updates made in this module […]
[…] Read the full article on my new website RidiCurious.com […]