DCSIMG
PowerGUI - Take control of the script editor - Shay Levy

Shay Levy

If you repeat it, PowerShell it!

PowerGUI - Take control of the script editor

In his PowerShell Editor Roundup: PowerGUI Pro blog post, Don mentions that PowerGUI's script editor lacks the ability to resolve 'alias-to-cmdlet'. Luckily we don't have to wait for next releases of PowerGUI or submit feature requests to have that functionality available. Starting with the latest product release, PowerGUI 2.1, we now have the option to extend the Script Editor with our own solutions using the new Script Editor SDK!

The Editor SDK allows us to create Add-Ons, add and remove menus and menu items, toolbar buttons, and a lot more. In this post I'm going to create a new toolbar, place a button in it and attach to it a code snippet (adapted from MVP Doug Finke) to make that missing feature available.

Download and expand Expand-Alias.zip, copy the icon file to your C drive and load the script (MyToolbar.ps1) into the script editor. Press F5 to execute it.

 

A new Toolbar is added with the Expand-Alias button in it.

 

Write some code with aliases in the Code pane

 

Now click the button or press CTRL+E to invoke the Expand-Alias command.

 

Awesome!

 

Some links to resources I've used:

 

PowerGUI 2.1 Quick tips on YouTube:

Create custom HTML pages inside your PowerPacks
Create chart templates to graphically display your powershell results.

Comments

Twitter Trackbacks for PowerGUI - Take control of the script editor - Shay Levy [microsoft.co.il] on Topsy.com said:

Pingback from  Twitter Trackbacks for                 PowerGUI - Take control of the script editor - Shay Levy         [microsoft.co.il]        on Topsy.com

# July 1, 2010 1:05 PM

Dmitry Sotnikov said:

Any plans to publish this as module in the PowerGUI.org library? This would let users simply select it in their PowerGUI / File / PowerShell Libraries and have the button always available.

Keep up the great work and congratulations on the MVP award!

Dmitry

# July 1, 2010 8:45 PM

ScriptFanatic said:

Thanks Dmitry, I will definitely add it to the modules directory.

# July 1, 2010 11:23 PM

PowerShell Hacker #8 said:

Pingback from  PowerShell Hacker #8

# July 3, 2010 3:14 PM

Shay Levy said:

In a previous post I wrote about the new PowerGUI Script Editor SDK and showed an example of creating

# July 8, 2010 12:34 PM
Leave a Comment

(required) 

(required) 

(optional)

(required) 


Enter the numbers above: