Wednesday, June 11, 2008

Close Encounters of the PowerShell Kind

 


Five tones:

$notes = 900,1000,800,400,600
$duration = 400,400,400,400,1600
0..($notes.length-1) | % {[console]::beep($notes[$_],$duration[$_]) }

 

Spaceship Siren:

1..10 | % { 370..470 | % { [console]::beep($_,5) }}

 

Talking alien :)

900,500,1000,800,400,600,1200,300,200,500,1100,300 | %{[console]::beep($_,100)}

 

CTP2 Alien:

1..20 | foreach { 
    
    $rnd = (Get-Random -min 0 -max 20)*100
    
    if($rnd -eq 0) {
        sleep -m 10
    } else {
        [console]::beep($rnd,100)
    }
}

No comments: