Posted By

Joeik on 07/26/12


Tagged


Versions (?)

Bus Alarm


 / Published in: Windows PowerShell
 

Spawns goose on the screen when it's time to go home

  1. function bus{
  2. while ($true){
  3. $oIE=new-object -com internetexplorer.application
  4. $Voice = new-object -com SAPI.SpVoice
  5. while ($oIE.busy) {sleep -milliseconds 50}
  6. $oIE.navigate2("http://rtt.metroinfo.org.nz/rtt/public/RoutePositionET.aspx?PlatformNo=39192")
  7. while ($oIE.busy) {sleep -milliseconds 50}
  8. $doc = $oIE.document
  9. $table = $doc.getElementById("335").childNodes.item(0).innerhtml -match 'QEII</td><td>([\d]*)</td>'
  10. $minute = $Matches[1]
  11. write-host $minute
  12. if ($minute -lt 5){
  13. start-job -ScriptBlock {cmd /c "C:\Users\davrov\Documents\Visual Studio 2010\Projects\WpfApplication1\WpfApplication1\bin\Debug\WpfApplication1.exe"}
  14. $Voice.Speak( $minute + " minute", 1 )
  15. }
  16. sleep 10
  17. }
  18. }
  19. start-job -ScriptBlock {bus}

Report this snippet  

You need to login to post a comment.