$wc = new-Object System.Net.WebClient
$nl = $wc.DownloadString("http://www.tphcc.gov.tw/library/offday.asp?Y=$(([Datetime]::now).Year)&M=$(([Datetime]::now).Month)&L=283");
$nl = $nl -replace '[\t\n\r\f]+'
$r = [regex]'size=-1>(.*?)</font>'
$m = $r.Matches($nl)
if([datetime]::now.day -lt [datetime]::now.adddays(1).day)
{
$matchstring = "$([datetime]::now.day);;(.*?);;$([datetime]::now.adddays(1).day)"
}
else
{
$matchstring = "$([datetime]::now.day);;(.*)"
}
if([string]::join(';;',@($m | ?{$_.length -gt 15 } | %{$_.groups[1].value})) -match $matchstring)
{
write-host ($matches[1].trim() -replace ";" ,"`n")
}
else
{
write-host "今天台北縣文化局可以正常借還書唷"
}
全站熱搜
留言列表