ÿþ######################################################### # Created by: Mariusz Gal # Date: Oct 17th, 2009 # Purpose: To get Illinois Lottery numbers ######################################################### $url = "http://illinoislottery.com/numbers.asp" $orglocation = get-location $htmlFilePath = $orglocation.path + "\numbers.asp" $path = $htmlFilePath $ReportDate = get-date -uformat "%Y-%m-%d" $TXTfilepath= $orglocation.path + "\" + $ReportDate + ".html" $myArray = @( ("<!--MEGA -->","Mega Millions"), ("<!--LOTTO -->","Lotto"), ("<!--LLOT -->","Little Lotto"), ("<!--MP3 -->","Midday Pick 3"), ("<!--EP3 -->","Evening Pick 3"), ("<!--MP4 -->","Midday Pick 4"), ("<!--EP4 -->","Evening Pick 4") ) $JackPots = @( ("<!--MMJP -->","Mega Millions"), ("<!--LJP -->","Lotto"), ("<!--LLJP -->","Little Lotto") ) $client = new-object System.Net.WebClient $client.DownloadFile($url,$path) $Line2File = "<strong><font size=large>Illinois Lottery</font></strong><br>" $Line2File | Out-File $TXTfilepath $Line2File = "<TABLE BORDER=0 width=30%>" $Line2File | Out-File $TXTfilepath -append $i=0 foreach ($e in $myArray) { $search = select-string -list -pattern $myArray[$i][0] -path $path | select-object LineNumber $result = @(gc $path)[$search.LineNumber] -replace "<b>", "" -replace ' {2,}','' -replace "<br>", "" write-host $myArray[$i][1] `t $result $Line2File = "<strong><font size=large>" + $myArray[$i][1] + ": " +"</font></strong><font>" + $result + "</font><br>" $Line2File | Out-File $TXTfilepath -append $i += 1 } $Line2File = "<strong><font size=large>Jackpots:</font></strong><br>" $Line2File | Out-File $TXTfilepath -append $j=0 foreach ($e in $JackPots) { $search = select-string -list -pattern $JackPots[$j][0] -path $path | select-object LineNumber $result = @(gc $path)[$search.LineNumber] -replace "<b>", "" -replace ' {2,}','' -replace "<br>", "" write-host "JackPot:" $JackPots[$j][1] `t $result $Line2File = "<strong><font size=large>" + $JackPots[$j][1] + ": " +"</font></strong><font>" + $result + "</font><br>" $Line2File | Out-File $TXTfilepath -append $j += 1 } $Line2File = "</TABLE>" $Line2File | Out-File $TXTfilepath -append #remove-item -path $path -force