PowerShell Remoting Project Home

Friday, November 30, 2007

PowerShell Script: Amazon WII Watch

I just wanted a WII for Christmas gift and didn't want to spend $500 on ebay.

A Small powershell script will do!


# Begin of script
# =============================================================
# This code is for test purposes only. Use it at your own risk.
# =============================================================
param([string] $query= "B0009VXBAQ", [string] $button = "btn-atc._V46858960_.gif")

#Submit query sequence
"================================================================="
"ASIN: " + $query
"Button: " + $button
""
"Submit query ..."
$uri="http://www.amazon.com/gp/product/" + $query
$AmazonClient = new-object System.Net.WebClient

#checking for results
While ($true)
{
$pagecontent = $AmazonClient.DownloadString($uri);
"================================================================="
# Get Availability
if ($pagecontent -match $button)
{
write-host "In Stock`a`a`a" -foregroundcolor Red
}
else
{
write-host "out of Stock" -foregroundcolor yellow
}
[datetime]::Now.tostring()
"Wait..."
Start-sleep 60
}

#End of script





=================================================================
out of Stock
2007-11-30 13:07:52
Wait...
=================================================================
In Stock

2007-11-30 13:08:58
Wait...
=================================================================
out of Stock
2007-11-30 13:10:01
Wait...
=================================================================
In Stock

2007-11-30 13:11:05
Wait...

Tags:       


Comments:
Thanks for sharing such an interesting information. I think this is really a very nice post. Thanks for the great content!
 

Post a Comment





<< Home