Custom read-host dialog for PowerShell 2 CTP3 ISE

By : Sathish
Source: Stackoverflow.com
Question!

Is it possible to hook a custom dialog into the new PowerShell ISE (Integrated Scripting Environment) that replaces the existing .NET WinForms dialog. I am talking about the dialog that the Read-Host cmdlet launches to request for user input.

By : Sathish


Answers

For example, see this URL: http://www.microsoft.com/technet/scriptcenter/resources/pstips/feb08/pstip0208.mspx

  1. Drop the full code into Notepad.
  2. Add the first line: function read-host {
  3. Add the last line: }
  4. Copy all the contents from Notepad.
  5. Paste it all into your PowerShell console.

Now, if you call read-host, you're going to see a new Windows Form.

Now, if I open other windows, it remains on top, but it seems it is not the top-most because I see it over everything else, but still need to click on it to make it active.



What you CAN do is create a custom function that overrides Read-Host, so you're effectively usurping Read-Host and subbing your own functionality.

By : Don Jones


For Ruby Lovers

ruby -e "puts ARGF.map(&:to_i).inject(&:+)" numbers.txt
By : johnlinvc


This video can help you solving your question :)
By: admin