/\/\o\/\/ PowerShelled

This blog has moved to http://ThePowerShellGuy.com Greetings /\/\o\/\/
$AtomFeed = ("Atom.xml")
$PreviousItems = (" Blog series about Errorhandling in MSH "," This Month's line-break and Pipelines are Back "," [msh]cd.. "," MSH start. Function "," Argggg "," Where are my pipelines "," WMI help Part 3 (Methods) "," WMI help Part 2 "," Wmi-Help Part 1 "," Create System Variable From MSH (Part2) "," ")

Thursday, November 10, 2005

 


Wipe the screen in MSH



MSH has a function Clear-host (alias CLS) for this,
only this one is a bit more colorfull ;-)

I think I had one on my Atari, that did some more modes,
like Horizontal - diagonal - square etc.

that's where the Mode param is for, also the speed and Colors could be configurable, but at second tought I stop here, leaving it parked for a while, but I'm sure I will come into a situation when I realy need them sometime in the future, so then I can quickly make those additions to the function and will post them to the blog also, but I don't know exactly when that will happen, till then feel free to let your own wipe-screen fantasies go ;-)

gr /\/\o\/\/

PS. if you think of a nice one feel free to leave it in a Comment.

#Wipe-Screen.msh
# Wipes your screen clear
#/\/\o\/\/ 2005
function Wipe-Screen{
Param ([int] $Mode = 1)

  # Get some info about the window 
  $raw = $host.ui.rawUI
  $WS = $raw.WindowSize
  $pos  = $raw.windowposition

  # lower the curtain 
  $fgc = [system.consolecolor]"Gray"
  $bgc = [system.consolecolor]"red"
  $row = $host.ui.rawui.NewBufferCellArray($("_" * $WS.Width),$fgc,$bgc)
  for($i ; $i -lt $WS.Height ; $i++ ) {
   sleep -m 5 
   $host.ui.rawui.SetBufferContents($pos,$row)
    $pos.y = $pos.y +1
  }

  # Raise it again 

  $bgc = [system.consolecolor]"Black"
  $row = $host.ui.rawui.NewBufferCellArray($(" " * $WS.Width),$fgc,$bgc)
  $i = $WS.Height + 1
  for($i ; $i -gt 0 ; $i-- ) {
    sleep -m 5
    $host.ui.rawui.SetBufferContents($pos,$row)
    $pos.y = $pos.y -1
  }

  # Cheat a little bit
  cls

}

Set-Alias WS Wipe-Screen



Comments:
Blogger Sung Meister
LOL, this one goes well with my "MSH >" prompt where "MSH" is colored red...
 
Post a Comment



<< Home

Archives

October 2005   November 2005   December 2005   January 2006   February 2006   March 2006   April 2006   May 2006   June 2006   July 2006   August 2006   September 2006   October 2006   November 2006   December 2006  

$Links = ("PowerShell RC1 Docs"," PowerShell RC1 X86"," PowerShell RC1 X64"," Monad GettingStarted guide"," Monad Progamming Guide"," Monad SDK"," Monad videos on Channel 9"," MSH Community Workspace"," scripts.readify.net "," MonadSource"," www.reskit.net"," PowerShell Blog"," Under The Stairs"," computerperformance powershell Home"," proudlyserving"," MSH on wikipedia"," MSHWiki Channel 9"," Keith Hill's Blog"," Precision Computing"," PowerShell for fun"," MSH Memo (Japanese)"," monadblog")

find-blog -about "PowerShell","Monad" | out-Technorati.
find-blog -contains "","" | out-Technorati.
Google
 
Web mow001.blogspot.com

This page is powered by Blogger. Isn't yours?