Add to Technorati Favorites
Welcome to ThePowerShellGuy.com Sign in | Join | Help

PowerShell TabExtension - Part 5 PowerTab 0.9

I made some mayor updates to my PowerShell TabExtension Function PowerTab , most important are

DoubleClick support and a TabItemSelector using RawUI to create a selectable and scollable list of the TabCompletion possibilities, offering a kind of Consolebased intellisense GUI, 

That adds a lot of extra functionalty and added value to the function. So I made a new version PowerTab 0.9 In this 5th part of the series I will descibe the added functionality and changes from the former version : PowerTab 0.8 PowerShell TabExtension - Part 4 Updates from 0.72 .  

For more information about the PowerTab suite and the rest of the series see also the PowerTab Overview Page where you allways can find the latest version for download, or you can use the TagList PowerTab to get a list of all former posts about PowerTab.

Updates from Version 0.8

  • Native Command Expansion (.EXE .COM.) with !
  • DoubleClick support
  • The TabItemSelector Output is now Extendable
  • Alias Completion uses DoubleTab now
  • Console TabItemSelector using RawUI to create Consolebased intellisense GUI
  • some other smaller fixes

I did see the following entry on Lee Holmes blog : http://www.leeholmes.com/blog/AddingDoubleTapTabCompletionToPowerShell.aspx , about adding DoubleClick support to TabCompletion. I was not very impressed by the functionality showed in the example, but I loved the idea of using DoubleTab to do alternate completion and did see the great possibilities that it could offer for my PowerShell TabExtension extension function PowerTab.

And when I did see how simple it was to implement the DoubleTab functionality I really got that *Doink* feeling, why didn't I think of that before, the actual change needed to enable DoubleTab support in my TabExpansion was this :

    # Detect DoubleTab
    
    Start-Sleep -m 400
    $DoubleTab = ($host.UI.RawUI.KeyAvailable)

 That was basicly all !!

Now I could check this $doubleTab variable within my tabcompletion function and react different depending on the state of $doubleTab.

As the expansion of aliases sometimes conflicts with FilePath expansion, for example say your in the sysinternal folder and, as most of the tools start with PS, want to tabcomplete on that, but PS is an alias hence you will get Get-Process.

With DoubleTab support I could and did fix that now by only expanding on aliases. 

More than that, as I allready changed my own version of PowerTab to support external handling of the output, to enable me to switch between "normal" tabcompletion and using Aaron Lerch: PowerTab Powershell Intellisense  (more about that in a later post) by setting a variable, now with DoubleClick Support I could enble them at the same time with only minor changes using :

[Tab] for normal tabcompletion

[DoubleTab] for Intelisense

But when I discussed my DoubleTab support on IRC with xaegr , the value of consolebased handling came up and I made an Out-ConsoleList function, for PowerTab to show a list with select and scoll capabilities, like intelitype without Forms, only the console using RawUI :

I added this function as a DoubleClick Handler to all the other PowerTab TabExpansion functionality, except alias and custom expansion as a changed them to use DoubleClick for normal invokation as mentioned before and there is nothing to select anyone as only one instance is returned.

So now you can use DoubleClick to get a list of options to choose from, making them much more visual by placing them in a list and enable you to view and select them using the Arrow UP and DOWN key's, adding a lot of extra value to PowerTab.

this added "Console based intellisense" for PowerShell in this new version looks like this :

WhenEver Possible the List will be Displayed below the current line at the place of the Cursor, if the list does not fit below, but does fit above it will be placed above, If the list does not fit Below or above it will be placed where the most lines are available and fill them all, as you can see below :

  

PoSH>                                                                                               
PoSH>       Get-Acl                                                                                 
PoSH>       get-Admin                                                                               
PoSH>       Get-Alias                                                                               
PoSH>       Get-AuthenticodeSignature                                                               
PoSH>       get-buffer                                                                              
PoSH>       Get-ChildItem                                                                           
PoSH>       Get-Command                                                                             
PoSH>       Get-ComputerManagement                                                                  
PoSH>       Get-Content                                                                             
PoSH>       Get-Credential                                                                          
PoSH>       Get-Culture                                                                             
PoSH>       Get-Date                                                                                
PoSH>       Get-EventLog                                                                            
PoSH>        [ 1 of 36 ]                                                                            
PoSH> get-                                                            

 

You can see above that you can use it with WMI classes and Cmdlets but you can use at for almost all functionality, try for example :

[Math]::[DoubleTab]

$h[DoubleTab]

$host.[DoubleTab]

[s[DoubleTab].[DoubleTab]

get-help about_[DoubleTab]

$global:[DoubleTab]

In the Console Output below I show a another nice usage example showing how you can make great use of this, combined with other PowerTab functionality, to CD to an UNC path using a list of computers to select from and than list the shares and select one. Also I will show how to get a list with all native commands starting with net by using the new ! native Command completion combined with DoubleTab: 

I use DoubleTab to list all add functions for TabExpansion, then add localHost to the list, also added computers discovered by netView.

After I show that after that can just type

 cd \\[DoubleTab]

To select a Computer, type

\\[DoubleTab]

to get a list of all shares (as a normal user and also hidden shares), to select from.

PoSH> add-tab                                                                                       
PoSH>                                                                                               
PoSH>          add-tabExpansion                                                                     
PoSH>          add-TabExpansionComputersNetView                                                     
PoSH>          add-TabExpansionComputersOU                                                          
PoSH>           [ 1 of 3 ]                                                                          
PoSH> add-tabExpansion Localhost Localhost Computer                                                 
                                                                                                    
Filter                            Text                             Type                             
------                            ----                             ----                             
Localhost                         Localhost                        Computer                         
                                                                                                    
                                                                                                    
PoSH> add-TabExpansionComputersNetView                                                              
                                                                                                    
Filter                            Text                             Type                             
------                            ----                             ----                             
MowServer1                        MowServer1                       Computer                         
MowServer2                        MowServer2                       Computer                         
MowServer3                        MowServer3                       Computer                         
                                                                                                    
                                                                                                    
PoSH> \\                                                                                            
PoSH>                                                                                               
PoSH>     \\Localhost                                                                               
PoSH>     \\MowServer1  
PoSH>     \\MowServer2  
PoSH>     \\MowServer3                                                                              
PoSH>      [ 1 of 2 ]                                                                               
PoSH> \\Localhost\                                                                                  
PoSH>                                                                                               
PoSH>               \\Localhost\ADMIN$                                                              
PoSH>               \\Localhost\C$                                                                  
PoSH>               \\Localhost\IPC$                                                                
PoSH>               \\Localhost\Posh                                                                
PoSH>                [ 1 of 4 ]                                                                     
PoSH>                                                                                               
PoSH>       net.exe                                                                                 
PoSH>       net1.exe                                                                                
PoSH>       netbtugc.exe                                                                            
PoSH>       netcfg.exe                                                                              
PoSH>       netiougc.exe                                                                            
PoSH>       Netplwiz.exe                                                                            
PoSH>       NetProj.exe                                                                             
PoSH>       netsh.exe                                                                               
PoSH>       NETSTAT.EXE                                                                             
PoSH>        [ 1 of 9 ]                                                                             
PoSH> net!                                                            

 

 You can from the last example how easy this makes to find and start programs in your path, but there are a lot more places this adds a lot off added value, see former posts for more information about other PowerTab Functionality.

*Update* If you want to see some extra examples of PowerTab 0.9 DoubleTab usage, Xaegr posted some more screendumps here : http://xaegr.livejournal.com/25934.html  (In Google English) 

If you are installing for the first time you can just run PowerTabSetup.Ps1 from the installation directory ( the folder you extracted the files in ) to setup PowerTab 0.9. ( for more info about the PowerTabSetup.ps1 script and the setup process see : PowerTab 0.72 PowerShell TabExtension - Part 1 Installation  )

*Note* If you are upgrading, take care the setup will not remove old configuration from profile you need to remove this manualy, see also readme file :

Place files in directory and Run the PowerTabSetup.ps1 setup routine, if upgrading from older version you might need to clean up old config from profile
or to upgrade manualy, replace files and add following line to Profile to be able to use RawUI Tabresultselection :

. 'C:\PowerShell\PowerTab\Out-ConsoleList.ps1' # Used for RawUi ConsoleList

I will post PowerTab 0.9 on the PowerTab Overview Page  , where you can always find the latest version.

 

Enjoy,

Greetings /\/\o\/\/ 

Published Monday, April 16, 2007 3:44 PM by admin

Comments

# The PowerShell Guy : PowerTab

Monday, April 16, 2007 4:51 PM by The PowerShell Guy : PowerTab

# Info : "Console based intellisense" Tabcompletion for PowerShell

I released a new version of my PowerTab PowerShell tabcompletion extension, [link] with what I think

Monday, April 16, 2007 5:26 PM by Latest Newsgroup Posts

# re: PowerShell TabExtension - Part 5 PowerTab 0.9

Dunno If you've already done it..

But I've got a power tab shortcut of

# Shortcuts

'=' { get-clipboard }

Where get-clipboard is from the pscx project, I use the alot... bit of a problem with this in that "=[Tab] replaces the "...

Monday, April 16, 2007 11:05 PM by Rob Lancaster

# re: PowerShell TabExtension - Part 5 PowerTab 0.9

Rob, this is done by the PowerSHell path escaping by "normal" tabcompletion

you neeed at least a space.

Greetings /\/\o\/\/

Tuesday, April 17, 2007 8:54 AM by MoW

# re: PowerShell TabExtension - Part 5 PowerTab 0.9

MOW,

Again nice work. Did you do/have you done any timing tests to compare console intellisense v Aarons's GUI based version? I noticed you mention a futher post revisiting Aaron's method; I look forward to this.

Pete

Tuesday, April 17, 2007 5:51 PM by Pete Gomersall

# re: PowerShell TabExtension - Part 5 PowerTab 0.9

Hiya, Pete

I did no performance test's between the 2,

The console based version has other pro's as not needing forms(remote console sessions PsExec or SSH for example)

Also I made some additions, but I contacted Aaron and he is working a a new version also.

as I made version 0.9 extendable, you can very easy switch to Aaron's Intelisense, if you have it installed also I did include a version of Aaron's intellisense that I did modify slightly, TabExpansionIntellisense.Ps1 ,for using intellisense in download, just needs to be loaded in profile)

after that just change this line in TabExpansion.ps1 :

   #$AlternateHandler = 'intellisense'

   $AlternateHandler = 'ConsoleList'

But as said, I expect a updated version from Aaron soon also.

Greetings /\/\o\/\/

Wednesday, April 18, 2007 5:40 AM by MoW

# re: PowerShell TabExtension - Part 5 PowerTab 0.9

I've got it updated, I'll post the new version as soon as I get a chance, probably around lunch time (EST (US) time)

Wednesday, April 18, 2007 9:50 AM by Aaron

# Lead, Follow, or Move » Blog Archive » PowerTab 0.9 has been released

# PowerShell TabExtension - Part 6 Customizing PowerTab 0.9

I mentioned in last post about the new version of PowerTab PowerShell TabExtension - Part 5 PowerTab

Wednesday, April 18, 2007 5:50 PM by The PowerShell Guy

# PowerTab 0.9 for PowerShell and Invoke-Intellisense | Aaron Lerch

# re: PowerShell TabExtension - Part 5 PowerTab 0.9

I am having several issue with my PS calling an old profile from .092 and then loading up.

The term 'C:\Users\Alex Larkin\Downloads\Powertab092\TabExpansion.ps1' is not recognized as a cmdlet, function, operable program, or script file. Verify the t

erm and try again.

At C:\Users\Administrator\Documents\WindowsPowerShell\Microsoft.PowerShell_prof

ile.ps1:9 char:2

+ .  <<<< 'C:\Users\Alex Larkin\Downloads\Powertab092\TabExpansion.ps1'

 # Load Tabcompletion function

The term 'C:\Users\Alex Larkin\Downloads\Powertab092\TabExpansionLib.ps1' is no

t recognized as a cmdlet, function, operable program, or script file. Verify th

e term and try again.

At C:\Users\Administrator\Documents\WindowsPowerShell\Microsoft.PowerShell_prof

ile.ps1:10 char:2

+ .  <<<< 'C:\Users\Alex Larkin\Downloads\Powertab092\TabExpansionLib.ps1'

Can you assist?

Thanks

Alex

Wednesday, September 12, 2007 8:30 AM by Alex Larkin

# re: PowerShell TabExtension - Part 5 PowerTab 0.9

Alex,

Just remove all old PowerTab code for your profile and rerun setup.

this should fix it.

Greetings /\/\o\/\/

Sunday, September 16, 2007 3:34 PM by MoW

# Intellisense ?? ?????????????? &laquo; PowerShell ?? ???????????? ??????????????

Anonymous comments are disabled