Webstores… gotta love them 🙂
I’ve written this small PowerShell function which you can use to monitor Amazon and let you know when a product is in store.
Modify the sleep value to your liking, now it checks every hour.
Very useful if you don’t want to check every few minute/hour/day yourself 🙂
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
function Watch-Amazone { param ( [parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)][string]$ASIN, [parameter(ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true, Mandatory = $false)][string]$Stock = "in stock", [parameter(ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true, Mandatory = $true)][string]$Interval = 3600 ) $query="http://www.amazon.com/gp/product/" + $ASIN $WebClient = New-Object System.Net.WebClient While ($true) { $Amazone = $WebClient.DownloadString($query) if ($Amazone -match $Stock) { Send-MailMessage -From "AmazoneWatch@domain.com" -To "user@domain.com" -Subject "Your product is now in stock at Amazone!" -Body "Get it now: $query" Write-Host "It's in stock!" -ForegroundColor green } else { Write-Host "Not in stock yet... please wait!" -ForegroundColor red } Start-sleep $interval } } |
How about setting the sleep interval as a function parameter also?
Good one… done!