PSHostUserInterface.PromptForChoice

Link. March 28, 2007. Comments [3]. Posted in: PowerShell

I've been working a bit lately with the Windows PowerShell hosting interfaces (PSHost and friends). I've got a basic host up and running (UI and all), but I'm still strugling a bit with some of the methods. So, here's one question for you PowerShell guys: What command will trigger a call to PSHostUserInterface.PromptForChoice()? (I can't write it if I don't know what the behavior is!)


Update: To answer my own question, two commands that use PromptForChoice are "export-console" and "remove-item -confirm".



Wednesday, March 28, 2007 1:13:15 PM (SA Pacific Standard Time, UTC-05:00)
Why not use something like http://PowerGUI.org to be the UI for your cmdlets instead? Could save you the time and effort doing the hosting, etc.
Wednesday, March 28, 2007 1:43:24 PM (SA Pacific Standard Time, UTC-05:00)
Dmitry: That's not an option in this case (particularly given that I'm not implementing an actual GUI). It's an interesting project, though.
Friday, March 30, 2007 8:32:07 AM (SA Pacific Standard Time, UTC-05:00)
All the CmdLets use this function for there confirm parameter, and it can be used for cmdlets for prompting user for input.

In the installer for my PowerTab tabcompletion you can find an example to use it directly for your own choices :

http://thepowershellguy.com/blogs/posh/archive/2007/01/17/powertab-0-72-powershell-tabextension-part-1-installation.aspx

PS in future version direct soppert for this in functions likely will be added .

Greetings /\/\o\/\/
Comments are closed.

Syndicate

About

Tomas Restrepo is a software developer located in Colombia, South America. His interests include .NET, Connected Systems, PowerShell and lately dynamic programming languages. More...

tomasrestrepo @ twitter My Flickr photostream My saved links on delicious My Technorati Profile

email: tomas@winterdom.com
msn: tomasr@passport.com

View my profile on LinkedIn

MVP logo

Ads


Links

Categories

Statistics

Total Posts: 1022
This Year: 92
This Month: 11
This Week: 0
Comments: 792

Blogroll

Post Archive

Other

Copyright © 2002-2008, Tomas Restrepo.

Powered by: newtelligence dasBlog 2.1.8139.823

Sign In