Monthly Archives: May 2012

Kindle price tracking.. First success!

My little script notified my of the first book that met the price conditions I set.

I am feeling pretty pleased with myself right now..

Here is the script I use..
Kindle Price tracking on Amazon with Powershell

Advertisements

Leave a comment

Filed under Amazon, Microsoft, Powershell

Loft conversion by Acorn Lofts of Rushden

I have just had a loft conversion done by Acorn Lofts of Rushden Northamptonshire.Image

 

 

Image

 

Acorn Lofts finished the process in approximately 11 weeks, including changes to the 2nd floor.

 

 

I might post a review later.

2 Comments

Filed under Uncategorized

Kindle Price tracking on Amazon with Powershell

I like reading books via the Kindle app, but unfortunately, a lot of price tracking websites seem to have problems with these (perhaps something to do with stock levels?). So the obvious solution was to write something in Powershell to do this. This runs on my Windows 7 PC using Powershell 3.0, and the .NET 4.0 extended framework.

It requires a .csv file with two columns, one called URL, and one called PRICE (which contains the price you would be willing to pay), and then simply a line for each (with no currency indicator on price. So no dollar, pound, euro etc).

I have a sample here:
http://tinyurl.com/cm9zwqv

I have only tried this with amazon.co.uk, so with any other Amazon site (such as Amazon.com) I suspect it will still work, but you would need to change the currency indicate (it currently trims a “£” and that would need to be a “$” or “€”…

Then, once you have the URL and target prices for the items, simply run it manually, or you can schedule it! If the price is below your threshold, it will prompt you to go to the webpage for the product.


No more constant checking of prices!

Param([string]$itemfile="items.csv")
del "$env:userprofile\my documents\http.txt" -ea SilentlyContinue

$items = (Import-Csv -Path $itemfile)
Foreach ($item in $items) {
	$path = $item.URL 
	$TargetPrice = $item.Price
	#Open page
	$ie = New-Object -ComObject InternetExplorer.Application
	$ie.Navigate("$path")
	While ($ie.Busy) { Start-Sleep -Milliseconds 200 }
	#Read contents
	$ie.Document.body.innerhtml | Out-File "$env:userprofile\my documents\http.txt"
	#Get price
	$nowPrice = (((get-content "$env:userprofile\my documents\http.txt" `
				| where {$_ -match "priceLarge"}).Split(">"))[2].Split(" ")[0]).TrimStart("£")
	#Get title
	$title = ((get-content "$env:userprofile\my documents\http.txt" `
				| where {$_ -match "parseasinTitle"}).Split(">"))[2].Split("<")[0]
	If ($path -ne $null) {
		Write-host "Current Price of $title = $nowPrice"
		#compare price
		If ([decimal]$nowPrice -le [decimal]$TargetPrice) {
			#Go to item page?
			$GotoPage = Read-Host "Target price of $nowPrice reached for $title. Go to this items page now (y/n)"
			If ($GotoPage -eq "y") {
				$ie.Visible = $true
				}
			Else {
				$ie.quit()
				}
			}
		Else {
			$ie.quit()
			}
		}

Or get the .PS1 file here:
http://tinyurl.com/boq4uwn

1 Comment

Filed under Amazon, Microsoft, Powershell

How many days until…

Rather than having to google/bing it, I thought I would write a really simply one-liner to find out how long until a certain date (Birthday, Christmas, etc).

So, the following command will prompt you for a date, and then tell you how long until we get there:

PSH [dropbox:\]: (get-date -date (read-host “How many days until”)) – (get-date)
How many days until: 1/6/2075

Days : 23027
Hours : 10
Minutes : 53
Seconds : 37
Milliseconds : 153
Ticks : 19895720171532698
TotalDays : 23027.4539022369
TotalHours : 552658.893653686
TotalMinutes : 33159533.6192212
TotalSeconds : 1989572017.15327
TotalMilliseconds : 1989572017153.27

Pretty simple, but I like Powershell for that reason!

Leave a comment

Filed under Microsoft, Powershell